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

registerReciever method exception android 14 for flag RECEIVER_EXPORTED #680

Open
sharif-ahmed opened this issue Jul 1, 2024 · 4 comments

Comments

@sharif-ahmed
Copy link

context.registerReceiver(priorityBackoffResetReceiver, IntentFilter(ACTION_QUEUE_BACKOFF_RESET))

@ghost
Copy link

ghost commented Aug 12, 2024

where should be use this context.registerReceiver(priorityBackoffResetReceiver, IntentFilter(ACTION_QUEUE_BACKOFF_RESET)) and on which version?

@hammadbawara
Copy link

hammadbawara commented Aug 21, 2024

How did you fix your issue? I am getting this broadcast error when I targetSdk to >= 33
error

RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

Full Error Log

FATAL EXCEPTION: main
                                                                                                    Process: com.example.download_testing, PID: 4096
                                                                                                    java.lang.RuntimeException: Unable to create application com.example.download_testing.MyApp: java.lang.SecurityException: com.example.download_testing: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7003)
                                                                                                    	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8177)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
                                                                                                    Caused by: java.lang.SecurityException: com.example.download_testing: 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:3057)
                                                                                                    	at android.os.Parcel.createException(Parcel.java:3041)
                                                                                                    	at android.os.Parcel.readException(Parcel.java:3024)
                                                                                                    	at android.os.Parcel.readException(Parcel.java:2966)
                                                                                                    	at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5684)
                                                                                                    	at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1852)
                                                                                                    	at android.app.ContextImpl.registerReceiver(ContextImpl.java:1792)
                                                                                                    	at android.app.ContextImpl.registerReceiver(ContextImpl.java:1780)
                                                                                                    	at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:755)
                                                                                                    	at com.tonyodev.fetch2.helper.PriorityListProcessorImpl.<init>(PriorityListProcessorImpl.kt:71)
                                                                                                    	at com.tonyodev.fetch2.fetch.FetchModulesBuilder$Modules.<init>(FetchModulesBuilder.kt:125)
                                                                                                    	at com.tonyodev.fetch2.fetch.FetchModulesBuilder.buildModulesFromPrefs(FetchModulesBuilder.kt:53)
                                                                                                    	at com.tonyodev.fetch2.Fetch$Impl.getInstance(Fetch.kt:1026)
                                                                                                    	at com.example.download_testing.MyApp.onCreate(MyApp.kt:44)
                                                                                                    	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6998)
                                                                                                    	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236) 
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205) 
                                                                                                    	at android.os.Looper.loop(Looper.java:294) 
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8177) 
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) 
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) 
                                                                                                    Caused by: android.os.RemoteException: Remote stack trace:
                                                                                                    	at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:13927)
                                                                                                    	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
                                                                                                    	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2720)
                                                                                                    	at android.os.Binder.execTransactInternal(Binder.java:1339)
                                                                                                    	at android.os.Binder.execTransact(Binder.java:1275)

@devpascoe
Copy link

Same @hammadbawara, any luck?

@hammadbawara
Copy link

@devpascoe There are some fixes available in the pull requests, but they haven't been merged yet. You can use that code and compile it yourself. Since this library hasn't been maintained for 4 years, it may cause more issues in the future, which is why I switched to another library.

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

3 participants