意识API。获取某些手机上的location.failure

P t*_*P t 8 android google-api google-awareness android-8.0-oreo android-9.0-pie

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();
            }
Run Code Online (Sandbox Code Playgroud)

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

在Android 9必需手机上运行该应用程序时,我收到此错误作为例外,但在Android 8 Samsung s8上运行时,我也不例外。

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

ild*_*niz 0

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