question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes on android 10 when use ACTIVITY_PROVIDER

See original GitHub issue

Your Environment

  • Plugin version: 3.1.0
  • Platform: Android
  • OS version: 10
  • Device manufacturer and model: Honor 10 Lite.

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

  1. Configuru background location with ACTIVITY_PROVIDER: BackgroundGeolocation.configure({locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER})
  2. Call BackgroundGeolocation.start()

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)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:16

github_iconTop GitHub Comments

4reactions
7h4r05commented, Sep 19, 2020

@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.

2reactions
rx2gocommented, Oct 6, 2020

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… <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" /> <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />

After I changed options it`s alived: stationaryRadius: 0, distanceFilter: 0,

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detect and diagnose crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
Why Do My Apps Keep Crashing on Android? - Avast
Apps on Android can crash because of low storage space, too many apps running simultaneously, a weak internet connection, or not having the ......
Read more >
My app works fine on Android 9 but Keeps Crashing on ...
1 Answer 1 ... Not sure but, Looks like you might have older play service libraries from which services are not able to...
Read more >
How to Resolve App Crashes in Android Studio?
1. Observe the App Crash ... Suppose you have built an application with multiple activities or fragments or both then you need to...
Read more >
New AdMob Activity crashes when running on device ...
When adding AdMob activity, apps crashes at the startup. (before invoking onCreate() of the MainActivity). Even removing the AdMob does not help.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found