如何检查Google Play服务是否最新 [英] how to check if Google Play Services is up to date
本文介绍了如何检查Google Play服务是否最新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用中,我需要使用Google Play服务的方式,因此首先,我必须检查用户手机中是否可以使用Google Play服务
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
这是我尝试过的:
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable( getApplicationContext() );
if(status == ConnectionResult.SUCCESS) {
//alarm to go and install Google Play Services
}
之后,如果已安装,我需要检查用户手机上的Google Play服务版本是否为最新我该怎么做 ??有什么主意吗?
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 ?
推荐答案
如果您从它将显示您 isGooglePlayServicesAvailable 将返回代码,并且该代码上的代码为 SERVICE_VERSION_UPDATE_REQUIRED
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
}
这篇关于如何检查Google Play服务是否最新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文