意识 API.在某些手机上获取位置故障


Awareness.SnapshotApi.getLocation(client)
    .setResultCallback(new ResultCallback<LocationResult>() {
        @Override
        public void onResult(@NonNull LocationResult locationResult) {
            if (locationResult.getStatus().isSuccess()) {
            }
        }
    }).addOnFailureListener(new OnFailureListener() {
        @Override
            public void onFailure(@NonNull Exception e) {
                String error = e.getMessage();
            }

com.google.android.gms.common.api.ApiException: 17: API: ContextManager.API 在此设备上不可用。

我在Android 9基本手机上运行该应用程序时收到此错误作为例外,但在Android 8三星s8上运行时没有异常。

我已更新到最新的 16.0.0 意识包。

就我而言,从 https://console.developers.google.com 为我的项目激活意识 API 解决了这个问题。

尝试为感知 API 注册围栏时出现相同的错误。如果要从 AndroidStudio 启动应用,请确保注册并使用 debug.keystore 创建的 API 密钥。

我在 mac 上的调试密钥库在 ~/.android/debug.keystore .

获取 API 密钥的 SHA1 的命令:keytool -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android

最新更新