mauron85/cordova-plugin-background-geolocation

app crashes when .start()

Closed this issue · 4 comments

Your Environment

  • Plugin version: 3.1.0
  • Platform: Android
  • OS version: Android 10
  • Device manufacturer and model: Huawei Mate 20 Pro
  • Running in Simulator:
  • Cordova version (cordova -v): 9.0.0 (cordova-lib@9.0.1)
  • Cordova platform version (cordova platform ls):Installed platforms: android 7.1.4
  • Plugin configuration options:
  • Link to your project:

Context

Expected Behavior

Actual Behavior

2020-06-08 13:56:45.044 17494-17494/com.webnologie.tracksmap E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.webnologie.tracksmap, PID: 17494
java.lang.SecurityException: Activity detection usage requires the ACTIVITY_RECOGNITION permission
at android.os.Parcel.createException(Parcel.java:2071)
at android.os.Parcel.readException(Parcel.java:2039)
at android.os.Parcel.readException(Parcel.java:1987)
at com.google.android.gms.internal.location.zza.transactAndReadExceptionReturnVoid(Unknown Source:10)
at com.google.android.gms.internal.location.zzap.zza(Unknown Source:15)
at com.google.android.gms.internal.location.zzaz.zza(Unknown Source:26)
at com.google.android.gms.internal.location.zzf.doExecute(Unknown Source:6)
at com.google.android.gms.common.api.internal.BaseImplementation$ApiMethodImpl.run(Unknown Source:19)
at com.google.android.gms.common.api.internal.zaah.execute(Unknown Source:20)
at com.google.android.gms.common.api.internal.zabe.execute(Unknown Source:23)
at com.google.android.gms.common.api.internal.zaaw.execute(Unknown Source:74)
at com.google.android.gms.internal.location.zze.requestActivityUpdates(Unknown Source:9)
at com.marianhello.bgloc.provider.ActivityRecognitionLocationProvider.attachRecorder(ActivityRecognitionLocationProvider.java:151)
at com.marianhello.bgloc.provider.ActivityRecognitionLocationProvider.onConnected(ActivityRecognitionLocationProvider.java:175)
at com.google.android.gms.common.internal.GmsClientEventManager.onConnectionSuccess(Unknown Source:34)
at com.google.android.gms.common.api.internal.zaaw.zab(Unknown Source:292)
at com.google.android.gms.common.api.internal.zaak.zaaq(Unknown Source:125)
at com.google.android.gms.common.api.internal.zaak.onConnected(Unknown Source:105)
at com.google.android.gms.common.api.internal.zabe.onConnected(Unknown Source:101)
at com.google.android.gms.common.api.internal.zaq.onConnected(Unknown Source:6)
at com.google.android.gms.common.internal.zaf.onConnected(Unknown Source:2)
at com.google.android.gms.common.internal.BaseGmsClient$zzf.zzm(Unknown Source:24)
at com.google.android.gms.common.internal.BaseGmsClient$zza.zza(Unknown Source:12)
at com.google.android.gms.common.internal.BaseGmsClient$zzc.zzo(Unknown Source:11)
at com.google.android.gms.common.internal.BaseGmsClient$zzb.handleMessage(Unknown Source:48)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8147)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

Possible Fix

Steps to Reproduce

Context

Debug logs

i had to chante the targetSdkVersion from 29 to 28 - now it seems to work.
<preference name="android-targetSdkVersion" value="28" />

With the new Google policies for android 10 this is not possible as it requires targetSdk 29.
Also when doing start() crash the application.
I hope an update of this plugin soon.

@RidClick did you find a solution? I need use tarketSdk 29... And app crashes...

@RidClick did you find a solution? I need use tarketSdk 29... And app crashes...

After the last update it seems to work.
However, just in case I am using cordova 9 and in the config.xml I have added
<preference name="android-minSdkVersion" value="22" /> <preference name="android-targetSdkVersion" value="29" />

and the plugin version is

<plugin name="@mauron85/cordova-plugin-background-geolocation" spec="^3.1.0" />