maplibre / maplibre/maplibre-plugins-android
[Offline Plugin] Miss security flags when registering the broadcast receiver in Android 14
- Dominant language
- Java
- Stars
- 50
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
I implemented the offline plugin and ran it on Android 14. The app met a crash due to missing security flags for the broadcast receiver.
Hope be fixed soon.
``` Kotlin
Caused by: java.lang.SecurityException: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
at android.os.Parcel.createException(Parcel.java:3053)
at android.os.Parcel.readException(Parcel.java:3036)
at android.os.Parcel.readException(Parcel.java:2978)
at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6157)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1913)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1853)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1841)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:772)
at org.maplibre.android.plugins.offline.offline.OfflineDownloadService.onCreate(OfflineDownloadService.java:65)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:5098)
at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2506)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8919)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
```
Contributor guide
Research direction
Start in OfflineDownloadService.java at line 65, where the broadcast receiver is registered, and review the Android 14 security-flag requirement. Verify the registration behavior on Android 14; done means the offline plugin no longer throws this SecurityException when the service starts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100