Adding Geofence gives ApiException status 13

Google got back to us to let us know that they've pushed a fix for this issue. I was able to confirm that my non-working device was now working.


I was doing some testing with the Android Q Beta and noticed that I would always get this error if my app had the new "Allow only while using the app" location permission. Even when the app was in the foreground, I was never able to add any Geofences with the location permission set to "Allow only while using the app" but as soon as I set my app's location permission to "Allow all the time" I can add Geofences no problem.

I am still seeing the problem on other API versions however, so unfortunately it doesn't really solve the problem entirely. I have a device running Android 8.0 and one running Android 9.0 and I still occasionally see the Status Error #13. I am not sure what to do on these devices because they don't have the new "Allow only while using the app" permission. They both have full location access.

I am adding this answer because it might help some users that are running the Android Q Beta or at least shed some light on what may be causing the problem. I do think it has something to do with the latest Google Play Services version because I think we are all doing everything right.

EDIT: I have added an issue on Google's Issue Tracker for this if anyone is interested in following... https://issuetracker.google.com/issues/135771329