HaylLtd / cordova-background-geolocation-plugin

Background and foreground geolocation plugin for Cordova.
Apache License 2.0
57 stars 66 forks source link

Use newer ACTIVITY_RECOGNITION permission #197

Closed pmlodawski closed 3 months ago

pmlodawski commented 3 months ago

Hi, first of all thanks for keeping original cordova location plugin up to date!

I found an issue on Android 14 where ACTIVITY_RECOGNITION did not appear in app settings, until I changed its name in AndroidManifest, as in this PR.

HarelM commented 3 months ago

How confident are you that this is a correct change?

HarelM commented 3 months ago

I still see some docs that are using it like this plugin: https://developer.android.com/develop/sensors-and-location/location/transitions Others are using it like you did: https://developer.android.com/reference/android/Manifest.permission#ACTIVITY_RECOGNITION

I don't know if this will break for older devices (i.e. below Android 14). Can we set both permissions just to be on the safe side?

pmlodawski commented 3 months ago

Permission name is changed in newer API: https://developers.google.com/android/reference/com/google/android/gms/location/ActivityRecognitionClient

For Android 10 (API level 29) and later: android.permission.ACTIVITY_RECOGNITION permission For Android 9 (API level 28) and earlier: com.google.android.gms.permission.ACTIVITY_RECOGNITION permission.

HarelM commented 3 months ago

Do you think the plugin should have both permissions to be on the safe side?

pmlodawski commented 3 months ago

@HarelM that's a good idea, I updated my PR