0

I know this seems like a duplicate of (Google Awareness API SecurityException is thrown) and it probably is but since my stackoverflow mojo isn't great enough I can't vote the question up or add comment and this is definitely not an answer. So I apologize in advance for the duplication.

As in the case above I see about 10% my awareness api calls (120K successes + 1.2K failures) receive a SecurityException with a -1 response code, I followed the current responders suggestions to verify the package name matched the name registered in the Awareness API registration step and they do match. If fact if I force them to be different I get the same exception but with a 6 as a response code not a -1; but this happens failure happens for every request not intermittently. And when I look in the Google Awareness API overview in the developer console I see approximately the same number of crashes as the number of Server Error (5XX) responses.

My question however is that if the Snapshot API offers method like

public static PendingResult<LocationResult> getLocation(GoogleApiClient client)

where the use of this method cannot catch the SecurityException thrown by the code that it invokes as the exception occurs in a separate thread of internal code's own creation. Why doesn't the Awareness API code just catch that SecurityException and handle it as if the LocationResult is a failure instead of crashing my application?

Community
  • 1
  • 1
  • I see similar behaviour when using the awareness api and opened this issue: https://code.google.com/p/android/issues/update.do?id=223751#makechanges Did you find a solution? – Florian Barth Sep 30 '16 at 16:37

2 Answers2

0

from: https://code.google.com/p/android/issues/detail?id=223751

There is a bug in our checks that is sometimes throwing this SecurityException when there is a network error to authenticate. The fix will rollout in the next version of Google Play services.

For now, the best workaround would be set up an UncaughtExceptionHandler on the thread that you call GoogleApiClient.connect(). For most folks, this would be on the main thread, which you can get via Looper.myLooper().getThread().

Florian Barth
  • 1,392
  • 12
  • 25
-1

The SecurityException is thrown in the call to GoogleApiClient.connect(). Please see Google Awareness API SecurityException is thrown for workaround.

Community
  • 1
  • 1
mochu
  • 74
  • 3