I've tried to implement my project geocode in Genymotion emulator, but it doesn't work. However the map works perfectly.
- Android build target : 4.2.2 With Google API
- Genymotion : Galaxy Nexus 4.2.2 With Google Apps
- And I've added the google-play-services_lib to my project
I've got this
E/GooglePlayServicesUtil(1954): The Google Play services resources were not found.
Check your project configuration to ensure that the resources are included.
anyone have a solutions? Thanks
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);
}
Looks like there is a way to install gapps in genymotion
i found this https://gist.github.com/wbroek/9321145
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Next Open your Genymotion VM and go to the Homescreen
Now Drag&Drop the Genymotion-ARM-Translation.zip onto the Genymotion VM window.
It should say "File transfer in progress", once it asks you to flash it click 'OK'
Now Reboot your VM using ADB. If nescessary you can simply close the VM window, not recommended
Once you're on the Homescreen again Drag&Drop the gapps-jb-20130813-signed.zip (or whatever version you got) onto your VM, and click 'OK' when asked
Once it finishes, again Reboot your VM and open the Google Play Store.
Sign in using your Google account
Once in the Store go to the 'My Apps' menu and let everything update (fixes a lot of issues), also try updating Google Play Services directly (https://play.google.com/store/apps/details?id=com.google.android.gms).
You can also search for Google Maps, update it manually (press update or install button) and you will receive the message to update Google Play Services
(For Android 4.4.4 and 5.0 is posible you need to reboot several times before updates are shown)
i recomend download gapps from
http://opengapps.org/ or http://www.teamandroid.com/gapps/ but they are more version in the gist link