Awareness API. Get location.failure on certain phones

671 Views Asked by At
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 is not available on this device.

I am receiving this error on as an exception for when running the app on a Android 9 essential phone, but no exception when running on Android 8 Samsung s8.

I have updated to the latest 16.0.0 awareness package.

2

There are 2 best solutions below

0
On

In my case, activating the Awareness API from https://console.developers.google.com for my project resolved this issue.

0
On

Had the same error while trying to register a fence for the Awareness API. If you are launching your app from AndroidStudio, make sure you registered and use an API key made with your debug.keystore .

My debug.keystore on mac was at ~/.android/debug.keystore.

Command to get your SHA1 for the API key : keytool -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android