Android 8或更高版本:检查Google Play服务 [英] Android 8 or higher: Check for Google Play Services

查看:882
本文介绍了Android 8或更高版本:检查Google Play服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此方法继续返回0.根据开发者文档,如果设备获得最新版本的Google Play,此方法应返回类似SUCCES的内容。有没有人知道如何使用这个?

this method keep returning 0. According to the developer docs this method should return something like SUCCES if the device got the newest version of google play. Does anybody know how to use this?

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

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


推荐答案

正在返回 SUCCESS 文档明确指出,该方法有一个int返回类型,并返回一个

It is returning SUCCESS. The documentation clearly states that the method had an int return type, and returns a


状态码,指示是否有错误。可以是ConnectionResult中的
之一:SUCCESS,SERVICE_MISSING,
SERVICE_VERSION_UPDATE_REQUIRED,SERVICE_DISABLED,SERVICE_INVALID。

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.

检查所返回的内容,使用以下内容:

To check against what was returned, use something like:

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

这篇关于Android 8或更高版本:检查Google Play服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆