cowbell / cordova-plugin-geofence

Geofencing plugin for cordova
Apache License 2.0
265 stars 316 forks source link

Crash when user denied location permission on Android 6.0+ #196

Closed adebree closed 7 years ago

adebree commented 7 years ago

When a user denies or revokes the location permission for an app using the cordova-plugin-geofence on an Android 6.0 or higher device the geofence plugin makes the app crash when using. Unfortunately the initialize() of the geofence only takes into account the permissions set in the manifest.

12-12 16:28:50.301  5062  5062 E AndroidRuntime: java.lang.SecurityException: Geofence usage requires ACCESS_FINE_LOCATION permission
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:1620)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:1573)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzarr$zza$zza.zza(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaru.zza(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaro$1.zza(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaro$1.zza(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzzv$zza.zzb(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaai.zzd(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaai.zzb(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaan.zzb(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaal.zzb(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaro.addGeofences(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaro.addGeofences(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.cowbell.cordova.geofence.AddGeofenceCommand.ExecuteCustomCode(AddGeofenceCommand.java:53)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.cowbell.cordova.geofence.AbstractGoogleServiceCommand.onConnected(AbstractGoogleServiceCommand.java:72)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.common.internal.zzm.zzq(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaal.zzo(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaaj.zzvE(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaaj.onConnected(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzaan.onConnected(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.internal.zzzy.onConnected(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.common.internal.zzl$1.onConnected(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.common.internal.zzf$zzj.zzwZ(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.common.internal.zzf$zza.zzc(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.common.internal.zzf$zza.zzu(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.common.internal.zzf$zze.zzxa(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.google.android.gms.common.internal.zzf$zzd.handleMessage(Unknown Source)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:158)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7229)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
12-12 16:28:50.301  5062  5062 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)