问题
In my app I need to use how Google Play Services , so at first I must check if Google Play Services is available in user's phone
This is what I've tried :
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable( getApplicationContext() );
if(status == ConnectionResult.SUCCESS) {
//alarm to go and install Google Play Services
}
after that if it's installed , I need to check Google Play Services version on the user's phone is up to date or not how can I do it ?? any idea ?
回答1:
If you check reference from here
it will show you isGooglePlayServicesAvailable will return code, and the on of that code is SERVICE_VERSION_UPDATE_REQUIRED
so you can do something like these
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable( getApplicationContext() );
if(status == ConnectionResult.SUCCESS) {
//alarm to go and install Google Play Services
}else if(status == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED){
Toast.makeText(context,"please udpate your google play service",Toast.LENGTH_SHORT).show
}
来源:https://stackoverflow.com/questions/27604213/how-to-check-if-google-play-services-is-up-to-date