I'm trying to work with google's awareness api, and register instance of GoogleApiClient to awareness api, but i'm receiving an error which i can't find anywhere.
I've followed the manual, and enabled awareness services in the api consule. https://developers.google.com/awareness/android-api/get-started
This is how my manifest looks like :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.awarenesstests">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.awareness.API_KEY"
android:value="MY_KEY_GENERATED_IN_THE_DEVELOPER_CONSULE" />
</application>
</manifest>
Very straightforward registration :
GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this)
.addApi(Awareness.API).build();
googleApiClient.connect();
This is the error i'm receiving - Invalid API Key for package = com.test.awarenesstests .Status code received = 6
Notice that there's something weird in the start of the log, a ping is made to google services and returning 403, it looks related to the final error.
07-10 15:35:50.745 29260-29490/? E/Volley: [6925] BasicNetwork.performRequest: Unexpected response code 403 for https://www.googleapis.com/usercontext/v1/controllerhub/ping
07-10 15:35:50.750 29260-29260/? E/ctxmgr: [BaseServerTask]Server task (PingTask) got error response.
com.android.volley.AuthFailureError
at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms:159)
at ipb.performRequest(:com.google.android.gms:64)
at com.android.volley.NetworkDispatcher.run(:com.google.android.gms:113)
07-10 15:35:50.755 29260-15589/? W/ctxmgr: [ContextManager3PCredentialsVerifier]Received a failed ping response with status code = 6
07-10 15:35:50.755 29260-29275/? E/AbstractServiceBroker: Getting service failed
java.lang.SecurityException: Invalid API Key for package = com.test.awarenesstests .Status code received = 6
at bti.a(:com.google.android.gms:109)
at btl.a(:com.google.android.gms:5046)
at iht.a(:com.google.android.gms:592)
at ikn.onTransact(:com.google.android.gms:824)
at android.os.Binder.execTransact(Binder.java:446)
07-10 15:35:50.756 9603-9603/com.test.awarenesstests D/AndroidRuntime: Shutting down VM
07-10 15:35:50.757 9603-9603/com.test.awarenesstests E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.test.awarenesstests, PID: 9603
java.lang.SecurityException: Invalid API Key for package = com.test.awarenesstests .Status code received = 6
at android.os.Parcel.readException(Parcel.java:1546)
at android.os.Parcel.readException(Parcel.java:1499)
at com.google.android.gms.common.internal.zzu$zza$zza.zza(Unknown Source)
at com.google.android.gms.common.internal.zzd.zza(Unknown Source)
at com.google.android.gms.internal.zzqb$zzc.zzapi(Unknown Source)
at com.google.android.gms.internal.zzqb$zzf.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at com.google.android.gms.internal.zzrs.run(Unknown Source)
at java.lang.Thread.run(Thread.java:818)