title: Service not available while calling geoCoder.getFromLocation()
body: <p>I know sometimes google back-end service might not be available.</p>
  
  <p>Hence a solution might be to loop until i get the data.</p>
  
  <pre><code>private class getLocationDetails extends AsyncTask&lt;String, Void, String&gt; {
  
      @Override
      protected String doInBackground(String... params) {
  
          Log.d("looping", "" + count + "");
          count++;
          double lat = Double.parseDouble(params[0]);
          double lng = Double.parseDouble(params[1]);
          List&lt;Address&gt; addresses = null;
          try {
  
              Geocoder gCoder = new Geocoder(ImageAndLocationActivity.this,
                      Locale.getDefault());
              addresses = gCoder.getFromLocation(lat, lng, 1);
              Address addr = addresses.get(0);
              user_country = addr.getCountryName();
              user_city = addr.getLocality();
              user_district = addr.getSubAdminArea();
  
              if (user_city == null) {
  
                  user_city = user_district;
              }
          } catch (Exception e) {
  
              Log.e("Exception in getLocationDetails - ", e.getMessage());
              return null;
          }
  
          return "";
      }
  
      @Override
      protected void onPostExecute(String result) {
  
          if (result != null) {
  
              Log.d("user_city = ", "" + user_city);
          } else {
  
              new getLocationDetails().execute(CurrentLat + "", CurrentLng
                      + "");
          }
      }
  
      @Override
      protected void onPreExecute() {
  
      }
  
      @Override
      protected void onProgressUpdate(Void... values) {
  
      }
  }
  </code></pre>
  
  <p>But i am not able to get the location at all:</p>
  
  <p><strong>LogCat:</strong></p>
  
  <pre><code>02-27 16:29:49.568: D/looping(10966): 110355
  02-27 16:29:49.568: E/Exception in getLocationDetails -(10966): Service not Available
  02-27 16:29:49.573: D/looping(10966): 110356
  02-27 16:29:49.573: E/Exception in getLocationDetails -(10966): Service not Available
  02-27 16:29:49.573: D/looping(10966): 110357
  02-27 16:29:49.573: E/Exception in getLocationDetails -(10966): Service not Available
  </code></pre>
  
  <p>and ofcourse i have added all the needed permissions:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  </code></pre>
  
  <p>I am trying this on <strong>Samsung Galaxy Note GT-N7000 (4.0.4 version)</strong></p>
  
  <p>Am i missing any settings? related to device or application ? Or this usually happens? If so any better solution to resolve this??</p>
  
  <p>Thank You</p>