0

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 ?

Phil3992
  • 1,059
  • 6
  • 21
  • 45
mohsen barati
  • 73
  • 2
  • 8

1 Answers1

3

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
}