我正在跟踪tutuorial使用谷歌位置服务.所以,我正在尝试使用Google API服务获取位置.但我得到isGooglePlayServicesAvailable
(这个)已被弃用的错误.谁能帮忙.谢谢
以下是我检查设备上是否存在Play服务的代码:
private boolean checkPlayServices(){
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(this);
if(resultCode != ConnectionResult.SUCCESS){
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)){
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
}else {
Toast.makeText(getApplicationContext(),
"This device is not supported", Toast.LENGTH_LONG)
.show();
finish();
}
return false;
}
return true;
}
Run Code Online (Sandbox Code Playgroud)