mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
725 stars 210 forks source link

Android Target API Level 31 fails on starting LocationProvider/TelemetryPlugin #1896

Open Markovicho opened 1 year ago

Markovicho commented 1 year ago

For Android new apps must target API Level 31 at minimum to be submitted in Google Play. For already exisiting apps updates are always restricted to that since November 1th.

But the telemtry plugin seems to fail in this case based on the creation of a pending intent missing "FLAG_IMMUTABLE".

Anyone around with a solution to this?

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.
2022.12.23 12:13:16.783 19432 19454 Error Unity   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 
2022.12.23 12:13:16.783 19432 19454 Error Unity   at UnityEngine.AndroidJNISafe.CallBooleanMethod (System.IntPtr obj, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <00000000000000000000000000000000>:0 
2022.12.23 12:13:16.783 19432 19454 Error Unity   at UnityEngine.AndroidJavaObject._Call[ReturnType] (System.String methodName, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0 
2022.12.23 12:13:16.783 19432 19454 Error Unity   at Mapbox.Unity.MapboxAccess.ConfigureTelemetry () [0x00000] in <00000000000000000000000000000000>:0 
2022.12.23 12:13:16.783 19432 19454 Error Unity   at Mapbox.Unity.MapboxAccess.SetConfiguration (Mapbox.U
brnkhy commented 7 months ago

I know we are late on this but in case anyone finds this issue; we are currently looking into this and pushed a few changes on MME branch here; https://github.com/mapbox/mapbox-unity-sdk/tree/mme if you give it a try, please let us know if that solves the issue or if any further changes/fixes are required.

brnkhy commented 7 months ago

after some further tests, I realized that branch isn't ready yet, I'll post an update here when the remaining issues are fixed.

brnkhy commented 7 months ago

@Markovicho after some more tests and improvements, I pushed the proposed fix here; https://github.com/mapbox/mapbox-unity-sdk/tree/androidEventsFix

JAMvlc commented 4 months ago

Hi @brnkhy, I have exactly the same problem as @Markovicho. Can you (or anyone) please explain - in simple terms, how I can correct this Mapbox error. Can you please explain how I can incorporate the above 'fix' into my Unity project. I have already tried manually updating the files - but this leads to other errors: 2024/07/01 13:45:11.421 20078 20097 Error Unity Error initializing telemetry: UnityEngine.AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat; 2024/07/01 13:45:11.421 20078 20097 Error Unity at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 2024/07/01 13:45:11.421 20078 20097 Error Unity at UnityEngine.AndroidJNISafe.CallBooleanMethod (System.IntPtr obj, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <00000000000000000000000000000000>:0 2024/07/01 13:45:11.421 20078 20097 Error Unity at UnityEngine.AndroidJavaObject._Call[ReturnType] (System.String methodName, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0 2024/07/01 13:45:11.421 20078 20097 Error Unity at Mapbox.Unity.Telemetry.TelemetryAndroid.SendTurnstile () [0x00000] in <00000000000000000000000000000000>:0 2024/07/01 13:45:11.421 20078 20097 Error Unity at Mapbox.Unity.MapboxAccess.ConfigureTelemetry () [0x00000] in <00000000000000000000000000000000>:0 2024/07/01 13:45:11.421 20078 20097 Error Unity at Mapbox.Unity.MapboxAccess+<TelemetryDelay>d__17.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 2024/07/01 13:45:11.421 20078 20097 Error Unity at Mapbox.Unity.Utilities.Runnable+Routine.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 Anyone around with a solution?