mauron85/cordova-plugin-background-geolocation

Add android:exported="true" to com.marianhello.bgloc.sync.AuthenticatorService to match android 12

coachaac opened this issue · 2 comments

need to match requirement for SDK31

Your Environment

  • Plugin version:
  • Platform: iOS or Android
  • OS version:
  • Device manufacturer and model:
  • Running in Simulator:
  • Cordova version (cordova -v):
  • Cordova platform version (cordova platform ls):
  • Plugin configuration options:
  • Link to your project:

Context

Expected Behavior

Actual Behavior

Possible Fix

Steps to Reproduce

Context

Debug logs

in the file cordova-plugin-background-geolocation/plugin.xml
Amend <service android:name="com.marianhello.bgloc.sync.AuthenticatorService"
add: android:exported="true"

I was able to fix this issue for myself and like to share the steps that I took:

AndroidManifest.xml
I have added to the permission.

I'm also using the the solution from here:
#719 (comment)

To request the ACTIVITY_RECOGNITION permission during run time.

plugin.xml

I have added android:exported="true" to AuthenticatorService LocationContentProvider and LocationServiceImpl

Those changes fixed the crash on startup but did not allow to run the service in background.

The fix for this was within the common background-geolocation-android repositorie. I had to update all PendingIntent in

ActivityRecognitionLocationProvider.java
NotificationHelper.java

to FLAG_MUTABLE

It seems to work fine for now.