Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please update to use ContextCompat #14

Open
dustin-graham opened this issue Jul 26, 2024 · 0 comments
Open

Please update to use ContextCompat #14

dustin-graham opened this issue Jul 26, 2024 · 0 comments

Comments

@dustin-graham
Copy link

On newer versions of Android I'm encountering a SecurityException because this library does not specify whether the receiver should be RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED.

Documentation:
https://developer.android.com/develop/background-work/background-tasks/broadcasts#context-registered-receivers
Related SO post:
https://stackoverflow.com/questions/77235063/one-of-receiver-exported-or-receiver-not-exported-should-be-specified-when-a-rec

exception in logs:

E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): java.lang.SecurityException: {package.name}: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Parcel.createException(Parcel.java:3041)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Parcel.readException(Parcel.java:3024)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Parcel.readException(Parcel.java:2966)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5684)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1852)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.app.ContextImpl.registerReceiver(ContextImpl.java:1792)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.app.ContextImpl.registerReceiver(ContextImpl.java:1780)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:755)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at de.kevlatus.flutter_broadcasts.CustomBroadcastReceiver.start(FlutterBroadcastsPlugin.kt:49)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at de.kevlatus.flutter_broadcasts.BroadcastManager.startReceiver(FlutterBroadcastsPlugin.kt:69)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at de.kevlatus.flutter_broadcasts.MethodCallHandlerImpl$onStartReceiver$1.invoke(FlutterBroadcastsPlugin.kt:122)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at de.kevlatus.flutter_broadcasts.MethodCallHandlerImpl$onStartReceiver$1.invoke(FlutterBroadcastsPlugin.kt:121)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at de.kevlatus.flutter_broadcasts.MethodCallHandlerImpl.withReceiverArgs(FlutterBroadcastsPlugin.kt:106)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at de.kevlatus.flutter_broadcasts.MethodCallHandlerImpl.onStartReceiver(FlutterBroadcastsPlugin.kt:121)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at de.kevlatus.flutter_broadcasts.MethodCallHandlerImpl.onMethodCall(FlutterBroadcastsPlugin.kt:153)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Handler.handleCallback(Handler.java:958)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Looper.loopOnce(Looper.java:205)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Looper.loop(Looper.java:294)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.app.ActivityThread.main(ActivityThread.java:8177)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): Caused by: android.os.RemoteException: Remote stack trace:
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:13927)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2720)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Binder.execTransactInternal(Binder.java:1339)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 	at android.os.Binder.execTransact(Binder.java:1275)
E/MethodChannel#de.kevlatus.flutter_broadcasts(27000): 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant