how to check if Google Play Services is up to date [duplicate]

扶醉桌前 提交于 2021-02-11 13:46:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!