gpt4 book ai didi

java - Android 8 或更高版本 : Check for Google Play Services

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:15:53 24 4
gpt4 key购买 nike

此方法一直返回 0。根据开发者文档,如果设备安装了最新版本的 google play,此方法应该返回类似 SUCCES 的内容。有人知道如何使用它吗?

@Override
public void onResume() {
super.onResume();

GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
System.out.println("henkie: " + GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()));
}

最佳答案

它正在返回 SUCCESSdocumentation清楚地指出该方法有一个 int 返回类型,并返回一个

status code indicating whether there was an error. Can be one of following in ConnectionResult: SUCCESS, SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED, SERVICE_DISABLED, SERVICE_INVALID.

要检查返回的内容,请使用类似的东西:

int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if(status == ConnectionResult.SUCCESS) {
//Success! Do what you want
}

关于java - Android 8 或更高版本 : Check for Google Play Services,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13766592/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com