Reputation: 4698
I've a Geofence implemented app which has been working fine on Android versions below Q. On Android-Q, geofence creation gets succeed when I choose "Allow location all time" but fails to create when I choose "Allow only while using the app".
Device: Google Pixel 2 XL O/S: Android-Q beta, last security patch update August 1, 2019
The error in case of choosing Allow only while using the app is **com.google.android.gms.common.api.ApiException: 13: **
The stacktrace is below:
2019-08-26 12:06:29.749 17668-17668/com.bdx.newhomesource.debug W/System.err: com.google.android.gms.common.api.ApiException: 13:
2019-08-26 12:06:29.750 17668-17668/com.bdx.newhomesource.debug W/System.err: at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source:4)
2019-08-26 12:06:29.752 17668-17668/com.bdx.newhomesource.debug W/System.err: at com.google.android.gms.common.internal.zai.zaf(Unknown Source:2)
2019-08-26 12:06:29.753 17668-17668/com.bdx.newhomesource.debug W/System.err: at com.google.android.gms.common.internal.zaj.onComplete(Unknown Source:6)
2019-08-26 12:06:29.754 17668-17668/com.bdx.newhomesource.debug W/System.err: at com.google.android.gms.common.api.internal.BasePendingResult.zaa(Unknown Source:172)
2019-08-26 12:06:29.755 17668-17668/com.bdx.newhomesource.debug W/System.err: at com.google.android.gms.common.api.internal.BasePendingResult.setResult(Unknown Source:131)
2019-08-26 12:06:29.757 17668-17668/com.bdx.newhomesource.debug W/System.err: at com.google.android.gms.common.api.internal.BaseImplementation$ApiMethodImpl.setResult(Unknown Source:36)
2019-08-26 12:06:29.758 17668-17668/com.bdx.newhomesource.debug W/System.err: at com.google.android.gms.internal.location.zzba.zza(Unknown Source:22)
2019-08-26 12:06:29.759 17668-17668/com.bdx.newhomesource.debug W/System.err: at com.google.android.gms.internal.location.zzan.dispatchTransaction(Unknown Source:47)
2019-08-26 12:06:29.760 17668-17668/com.bdx.newhomesource.debug W/System.err: at com.google.android.gms.internal.location.zzb.onTransact(Unknown Source:22)
2019-08-26 12:06:29.762 17668-17668/com.bdx.newhomesource.debug W/System.err: at android.os.Binder.execTransactInternal(Binder.java:1021)
2019-08-26 12:06:29.764 17668-17668/com.bdx.newhomesource.debug W/System.err: at android.os.Binder.execTransact(Binder.java:994)
Upvotes: 3
Views: 1671
Reputation: 585
I ran into this problem several months ago and I had created a bug report on Google's issue tracker. They closed the bug report and said that this is the intended behavior.
I understand that Geofences shouldn't be able to be registered when your permission is set to foreground only. I just think they could've used a better error code. Error code 13 represents "failed for an unknown reason" when in reality the reason is very clear.
So yeah, this is the intended behavior but the error code and error message are really no help.
Upvotes: 5