I'm building an app using google map v2, it requires google play services, so I added this validation to check for it:
int checkGooglePlayServices = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(myContext);
if (checkGooglePlayServices != ConnectionResult.SUCCESS) {
// google play services is missing!!!!
/*
* Returns status code indicating whether there was an error.
* Can be one of following in ConnectionResult: SUCCESS,
* SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED,
* SERVICE_DISABLED, SERVICE_INVALID.
*/
GooglePlayServicesUtil.getErrorDialog(checkGooglePlayServices,
myContext, REQUEST_CODE_RECOVER_PLAY_SERVICES).show();
}
So it turns out I have a device 4.0.4 that didn't come with google play services (why? I dont know, but it has gmail, and maps working fine), when I run the app the validation works and takes me to play store to install/update google play services, however the page says: Your device isn't compatible with this version.
So how do I install google play service if it is not available on play store?
is it common to have android devices without this app ?
thanks,
The error seems to suggest the play services version on your device is not compatible with the play services library used by your app. Where does it say the play services is not available on your device.
To make sure the play services in running on your device, and to find out its version, look in Settings -> Apps -> Downloaded -> Google Play Services
Since it is not giving you an option to update the play services on device, I would consider using a matching play services client library in your app. You can easily do this on Android studio build.gradle of the app module by adding exact version to your dependencies like so
dependencies {
compile 'com.google.android.gms:play-services:5.0.89'
}
replace 5.0.89 with the version you find on your device.
Related
This question already has answers here:
updating Google play services in Emulator
(12 answers)
Closed 4 years ago.
I'm developing an application with android studio and i use an emulated android device to test it. The emulated device is Nexus 4 with Android 4.4 (with google apis).
In my project, i use the lastest play service client version, the 9.2.0:
When i launch my app on emulator, following message appeare:
The question is: how can i upgrade play service on emulator? Tnx
Just add Google Play Services to you project. To make the Google Play Services API's available to your app, add a new build rule under dependencies for the latest version of play-services.
Open the build.gradle file inside your application module directory.
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.google.android.gms:play-services:9.2.0'
}
Be sure you update this version number each time Google Play services is updated.
As described in the Google Play services overview, Google Play delivers service updates for users on Android 2.3 and higher through the Google Play Store app. However, updates might not reach all users immediately, so your app should verify the version available before attempting to perform API transactions.
Because each app uses Google Play services differently, it's up to you decide the appropriate place in your app to verify the Google Play services version. For example, if Google Play services is required for your app at all times, you might want to do it when your app first launches. On the other hand, if Google Play services is an optional part of your app, you can check the version only once the user navigates to that portion of your app.
You are strongly encouraged to use the GoogleApiClient class to access Google Play services features. This approach allows you to attach an OnConnectionFailedListener object to your client. To detect if the device has the appropriate version of the Google Play services APK, implement the onConnectionFailed() callback method. If the connection fails due to a missing or out-of-date version of the Google Play APK, the callback receives an error code such as SERVICE_MISSING,
I have installed built and installed an android app on MC40 device. The app uses internally GCM services. MC40 does not have google play services pre-installed.So I have included google play services in gradle compile com.google.android.gms:play-services:8.4.0 and bundled with app but when I run app on MC40 device ,it still asks for google play services has to be installed. is there any solution for this problem?
I am trying to implement google play location services in my android app. I have followed this tutorial
It does not works on some devices. The google api client does not connects. It always goes to the callback method onConnectionFailed.
I am using Android Studio and in the gradle file, I have added the following line:
compile 'com.google.android.gms:play-services-location:7.8.0'
So far I have found is that the version mentioned in the project (7.8.0) is more than the play services version installed in the device (7.5.71). So, it goes to the callback onConnectionFailed with the error code 2.
On changing the version in gradle file from 7.8.0 to 7.5.0, it works fine in these devices also.
So, is there any workaround so that I will be able to use the latest version and still be able to run it without any problem in the devices which does not have the latest version?
Google Play Services updates on its own in the background. If the device has not yet been updated to the latest version, you can show a prompt instead and ask the user to update it manually by opening Google Play Services on Google Play
I recently updated the android google sdk with the latest version of google play services library (7.5).
Since the update I cannot run my app on emulator : when I click sign in button a pop up appears saying that I need to install the latest version of google play games app.
Of course I'm using the latest google apis for the emulator image. What happens? Did I miss something?
It turns that now google play services is linked to google play games app. It seems that if you don't have the app installed you cannot run the game that uses google play services. The emulator of course come without the games app I have to manually install the apk and now it works again. :-o
Error shown on android emulator :
"Google Play services ,which some of your application rely on, is not
supported by your device. Please contact the manufacturer for
assistance"
I have generated the key required to add in manifest, installed google play services and added reference to my project. my AVD is android 4.2.2(17)
I have also installed google api for android 4.2.2(17)
but still it isn't working.
Google play services are not installed in the emulators. You have to manually install the APKs for the required services you want to run on the emulator.
and as an alternative you can use genymotion emulator, they are pretty fast and come with google play services.