Google Play服务示例:"connectionResult无法解析"

pol*_*kyg 14 android google-play-services

当我试图按照如何检查是否安装了Google Play服务的示例时,我收到以下错误:serviceConnected方法中的行中的"connectionResult无法解析"

int errorCode = connectionResult.getErrorCode();
Run Code Online (Sandbox Code Playgroud)

有什么可以遗漏?我正在复制并粘贴它.我在这里关注这个例子

谢谢!

Joe*_*lin 43

这是示例中的一个错误.请改用:

        } else {
        // Get the error code
        // Get the error dialog from Google Play services
        Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
                resultCode,
                this,
                CONNECTION_FAILURE_RESOLUTION_REQUEST);
Run Code Online (Sandbox Code Playgroud)

  • 他们的servicesConnected()也没有return语句,这真是假. (11认同)