The geocoder is notoriously unreliable on older devices (as well as on Genymotion so I use a helper class that works in all enviornments) as well as problematic in general as a class (and accuracy of results).
You can use google maps to do geolocation very easily,
An asynctask I wrote to use Geocoder first and fallback to a HttpRequest (using volley) if that fails is at https://gist.github.com/selecsosi/6705630
the relevant part:
Make a request to
"http://maps.google.com/maps/api/geocode/json?address=" + URLEncoder.encode(mAddress, "utf-8") + "&ka&sensor=false"
with mAddress being the location you are searching for.
That request will return you a JSON object you can parse like so
public static LatLng getLatLngFromGoogleJson(JSONObject jsonObject) {
double lon = 0d;
double lat = 0d;
try {
lon = ((JSONArray)jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lng");
lat = ((JSONArray)jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lat");
} catch (JSONException e) {
if(Log.isLoggable(TAG, Log.ERROR))Log.e(TAG, "Error parsing google response", e);
}
return new LatLng(lat, lon);
}