Configuration
- Android OS Version: 12 (or above)
- Build Taget Level API: 31 (or above)
- Device model(s): any device
Steps to Reproduce
Use mapbox-android-core ( libtelemetry,libcore etc.) embedded into android application with Target API Level 31. You'll receive errors and crashing application based on this API change.
error message before crash
2022.12.23 12:13:16.783 19432 19454 Error Unity Error initializing telemetry: UnityEngine.AndroidJavaException: java.lang.IllegalArgumentException: com.nmy.unseen: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. 2022.12.23 12:13:16.783 19432 19454 Error Unity 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.
Consequences
We recognized this issue some time ago but were fine with using API Level 30 as target. From end of 2022 its not longer possible to submit or update applications which are not targeting API Level 31 or above which is very critical. It's also very interesting that this is not reported already as there should be more developers submitting mapbox apps to the PlayStore. This issue will be criticial for every developer using this mapbox library on Android.
Additional information
For example the class LocationEngineControllerImpl.java is already taking this into account based on a comment/TODO:
|
flags |= 33554432; //TODO: replace with PendingIntent.FLAG_MUTABLE after Android 12 release |

refer to : https://github.com/mapbox/mapbox-events-android/blob/main/libtelemetry/src/main/java/com/mapbox/android/telemetry/location/LocationEngineControllerImpl.java
Solution
refer to this solution on stackoverflow:
https://stackoverflow.com/questions/67045607/how-to-resolve-missing-pendingintent-mutability-flag-lint-warning-in-android-a