-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App crashes on android 10 when use ACTIVITY_PROVIDER #719
Comments
Hi, Android 10 requires an ACTIVITY_RECOGNITION permission to be asked explicitly. The fix is to update the permissions in BackgroundGeolocationFacade & LocationManager from
to
also make sure it exists in AndroidManifest.xml under uses-permission @mauron85 I tried to add branch with fix, but seems it's prohibited. Can you review above changes? Fixed on my devices. Thanks Note above will work for android >= 10, for android < 10 the permissions ACTIVITY_RECOGNITION should not be added |
Hi @7h4r05, I'm trying to deal with this problem and I can't resolve it. Could you create a fork with this fix please? Thank you very much. |
@bjdose hey man, sorry for delay. I created a fork here https://github.com/7h4r05/cordova-plugin-background-geolocation. Please let me know if it works for you. |
I'm stucked on this for months. Trying to update my app to work with android X. If I manually grant the permission ACTIVITY_RECOGNITION (which is Phisycal Activity permission on the Android app) the plugin works great. Any fix for this? |
Hi @jgauna , |
I have this error. This plugin is supporting APIs 29 o Higher? @7h4r05 adding the permission solvent this error? |
Thanks @biote-ven , |
@biote-ven yes, the Activity_Recognition permission is required for API >= 29, but for below versions you have to skip asking for that permission.
|
In config.xml add and update Manifest (android.permission.ACTIVITY_RECOGNITION) using config-file In the java file (BackgroundGeolocationFacade & LocationManager) add: Can you indicate the place to put this sentences? Tx |
Okay, I made it works.. but BackgroundGeolocation.getCurrentLocation always returns the same value in background. It works well on foreground.. and it does not send any requests to url or syncUrl as well.. Worked after added to Manifest following 2 strings and manually added permision at app settings.. After I changed options it`s alived: |
In low or equal API 28 working fine. But since API 29, it doesn't work. Sad! |
Apply this in TS file y the crash not ocurred... but the app is unestable. Not take coordinates! Next login is crash! Researching another alternatives.... have some more action i can make with this plugin? |
@7h4r05 does your fork working fine at 19 september ? |
@dabaaaz I haven't tested it like this. I use it for tracking when user trigger it first. |
I had this problem. And I managed to solve it like this: installed the plugin https://github.com/NeoLSN/cordova-plugin-android-permissions#readme and make a request to use ACTIVITY_RECOGNITION.
This causes an additional request from the user and there is no error |
You need request ACTIVITY_RECOGNITION. This worked for me: |
Your Environment
Context
When call BackgroundGeolocation.start() app crashes
Expected Behavior
Start background geolocation.
Actual Behavior
App crashes
Possible Fix
https://developer.android.com/about/versions/10/privacy/changes#physical-activity-recognition
Steps to Reproduce
BackgroundGeolocation.configure({locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER})
Debug logs
08-18 11:28:22.384 6724 6724 E AndroidRuntime: FATAL EXCEPTION: main 08-18 11:28:22.384 6724 6724 E AndroidRuntime: Process: ru.okdesk.mobile, PID: 6724 08-18 11:28:22.384 6724 6724 E AndroidRuntime: java.lang.SecurityException: Activity detection usage requires the ACTIVITY_RECOGNITION permission 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:2071) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:2039) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1987) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzed.zzb(Unknown Source:10) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzccz.zza(Unknown Source:15) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzcdi.zza(Unknown Source:26) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzcbt.zza(Unknown Source:6) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzbax.zzb(Unknown Source:0) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzbbz.zze(Unknown Source:69) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzbcw.zze(Unknown Source:5) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzbco.zze(Unknown Source:152) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzcbs.requestActivityUpdates(Unknown Source:9) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.marianhello.bgloc.provider.ActivityRecognitionLocationProvider.attachRecorder(ActivityRecognitionLocationProvider.java:151) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.marianhello.bgloc.provider.ActivityRecognitionLocationProvider.onConnected(ActivityRecognitionLocationProvider.java:175) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.common.internal.zzac.zzn(Unknown Source:109) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzbco.zzm(Unknown Source:22) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzbcc.zzpY(Unknown Source:89) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzbcc.onConnected(Unknown Source:21) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzbcw.onConnected(Unknown Source:7) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.internal.zzbbh.onConnected(Unknown Source:5) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.common.internal.zzaa.onConnected(Unknown Source:2) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.common.internal.zzn.zzrj(Unknown Source:152) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.common.internal.zze.zzs(Unknown Source:48) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.common.internal.zzi.zzrk(Unknown Source:57) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.google.android.gms.common.internal.zzh.handleMessage(Unknown Source:275) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at android.os.Looper.loop(Looper.java:213) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8178) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 08-18 11:28:22.384 6724 6724 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: FATAL EXCEPTION: mainjava.lang.SecurityException: Activity detection usage requires the ACTIVITY_RECOGNITION permission 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at android.os.Parcel.createException(Parcel.java:2071) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at android.os.Parcel.readException(Parcel.java:2039) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at android.os.Parcel.readException(Parcel.java:1987) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzed.zzb(Unknown Source:10) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzccz.zza(Unknown Source:15) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzcdi.zza(Unknown Source:26) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzcbt.zza(Unknown Source:6) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzbax.zzb(Unknown Source:0) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzbbz.zze(Unknown Source:69) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzbcw.zze(Unknown Source:5) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzbco.zze(Unknown Source:152) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzcbs.requestActivityUpdates(Unknown Source:9) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.marianhello.bgloc.provider.ActivityRecognitionLocationProvider.attachRecorder(ActivityRecognitionLocationProvider.java:151) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.marianhello.bgloc.provider.ActivityRecognitionLocationProvider.onConnected(ActivityRecognitionLocationProvider.java:175) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.common.internal.zzac.zzn(Unknown Source:109) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzbco.zzm(Unknown Source:22) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzbcc.zzpY(Unknown Source:89) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzbcc.onConnected(Unknown Source:21) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzbcw.onConnected(Unknown Source:7) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.internal.zzbbh.onConnected(Unknown Source:5) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.common.internal.zzaa.onConnected(Unknown Source:2) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.common.internal.zzn.zzrj(Unknown Source:152) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.common.internal.zze.zzs(Unknown Source:48) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.common.internal.zzi.zzrk(Unknown Source:57) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.google.android.gms.common.internal.zzh.handleMessage(Unknown Source:275) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at android.os.Handler.dispatchMessage(Handler.java:107) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at android.os.Looper.loop(Looper.java:213) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at android.app.ActivityThread.main(ActivityThread.java:8178) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at java.lang.reflect.Method.invoke(Native Method) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 08-18 11:28:22.387 6724 6724 E com.marianhello.logging.UncaughtExceptionLogger: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
The text was updated successfully, but these errors were encountered: