I'm trying to get the last known location in my Android Emulator from Android Studio by following this tutorial https://developer.android.com/training/location/retrieve-current.html
However, the callback method onConnectionFailed
is called with error code: 2
. When I show the error dialog in my emulator, it says:
Update Google Play Services
{app_name} won't run unless you update Google Play services.
UPDATE
when I click UPDATE
button, I got an error message:
E/SettingsRedirect﹕ Can't redirect to app settings for Google Play services
I think the problem is because Google Play services is not included in the emulator. I tried following the answer here too Android Studio with Google Play Services, but it didn't work.
It says on Google documentation:
To test your app when using the Google Play services SDK, you must use either:
1.) A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
2.) The Android emulator with an AVD that runs the Google APIs platform based on >Android 4.2.2 or higher.
Can somebody tell me how to do point 2 ?
My AVD is Nexus 5 API 22 x86