Closed chos-agoop closed 1 year ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
Same issue happening with us, Any solution found?
Facing below error while accessing location:
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. at android.app.PendingIntent.checkFlags(PendingIntent.java:375) at android.app.PendingIntent.buildServicePendingIntent(PendingIntent.java:724) at android.app.PendingIntent.getForegroundService(PendingIntent.java:716) at com.transistorsoft.locationmanager.location.SingleLocationRequest.getPendingIntent(Unknown Source:47) at com.transistorsoft.locationmanager.location.SingleLocationRequest.startUpdatingLocation(Unknown Source:48) at com.transistorsoft.locationmanager.location.SingleLocationRequest$a.onPermissionGranted(Unknown Source:36) at com.transistorsoft.locationmanager.util.c$i.onPermissionGranted(Unknown Source:41) at com.intentfilter.androidpermissions.PermissionHandler.checkPermissions(PermissionHandler.java:41) at com.intentfilter.androidpermissions.PermissionManager.checkPermissions(PermissionManager.java:50) at com.transistorsoft.locationmanager.util.c$g.run(Unknown Source:31) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:233) at android.os.Looper.loop(Looper.java:334) at android.app.ActivityThread.main(ActivityThread.java:8513) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
Yes, and what version of the plugin are you using?
Our purchased license is for - cordova-background-geolocation - 3.9.4
That is your problem. Go look at the CHANGELOG here in this repo and upgrade your plugin version to latest.
3.9.4 was released two years ago, before api 31 existed.
Your Environment
Plugin version: 4.4.2
Platform:Android
OS version: Android 12(target 31)
Device manufacturer / model: AQUOS Zero6
Cordova version (
cordova -v
): 11.0.0Cordova platform version (
cordova platform ls
): Installed platforms: android 10.1.2 ios 6.2.0 Available platforms: browser ^6.0.0 electron ^3.0.0 osx ^6.0.0Plugin config provided to
#ready
:Expected Behavior
The plugin can work on Android 12 devices and targetAPI=31 application with no crash.
Actual Behavior
When the device is rebooted, a crash occurred. please review the debug log.
Steps to Reproduce
Context
We are trying to put the plugin to our app, the target api of our android app is 31 and the app doesn't own the ACTIVITY_RECOGNITION permission. By the way, I think the crash is from (https://github.com/nishkarsh/android-permissions), we also tried to update the library version, it still occurred the crash when the plugin is installed at first, we think it need be fixed inside the Plugin.
Debug logs
2022-04-28 17:45:45.185 10465-10504/jp.co.test.com.example D/TSLocationManager: [c.t.locationmanager.util.c h] ℹ️ LocationAuthorization: Permission granted 2022-04-28 17:45:45.185 10465-10504/jp.co.test.com.example I/TSLocationManager: [c.t.l.service.HeartbeatService b] 🎾 Start heartbeat (60s) 2022-04-28 17:45:45.193 10465-10465/jp.co.test.com.example D/TSLocationManager: [c.t.l.a.BackgroundGeolocation isMainActivityActive] NO 2022-04-28 17:45:45.209 10465-10465/jp.co.test.com.example D/AndroidRuntime: Shutting down VM 2022-04-28 17:45:45.212 10465-10465/jp.co.test.com.example E/AndroidRuntime: FATAL EXCEPTION: main Process: jp.co.test.com.example, PID: 10465 java.lang.IllegalArgumentException: jp.co.test.com.example: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. at android.app.PendingIntent.checkFlags(PendingIntent.java:378) at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:648) at android.app.PendingIntent.getBroadcast(PendingIntent.java:635) at com.intentfilter.androidpermissions.PermissionManager.notificationDismissIntent(PermissionManager.java:103) at com.intentfilter.androidpermissions.PermissionManager.showPermissionNotification(PermissionManager.java:69) at com.intentfilter.androidpermissions.PermissionHandler.requestPermissions(PermissionHandler.java:72) at com.intentfilter.androidpermissions.PermissionHandler.checkPermissions(PermissionHandler.java:47) at com.intentfilter.androidpermissions.PermissionManager.checkPermissions(PermissionManager.java:50) at com.transistorsoft.locationmanager.util.c$i.run(Unknown Source:15) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:8064) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1026)
``` PASTE_YOUR_LOGS_HERE ```