react-native-bluetooth-classic icon indicating copy to clipboard operation
react-native-bluetooth-classic copied to clipboard

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

Open trungphammycolor opened this issue 1 year ago • 5 comments

Mobile Device Environment Provide a list of operating systems on which this issue is relevant.

  • Device: Google Pixel (Emulator)
  • OS: Android 14 (API level 34)

Application Environment Provide information about your development environment:

  • React Native version: 0.73.0
  • RN Bluetooth Classic version: 1.73.0-rc.12

Describe the bug The app shut down immediately To Reproduce Steps to reproduce the behavior: Build and run app Expected behavior A clear and concise description of what you expected to happen.

Screenshots image Android studio log:

FATAL EXCEPTION: main
 Process: com.pangaea.app, PID: 12295
java.lang.RuntimeException: Unable to get provider com.deploygate.sdk.DeployGateProvider: java.lang.SecurityException: com.pangaea.app: 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.installProvider(ActivityThread.java:7770)
                                                                                                    	at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276)
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983)
                                                                                                    	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.pangaea.app: 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.deploygate.sdk.DeployGate.prepareBroadcastReceiver(DeployGate.java:273)
                                                                                                    	at com.deploygate.sdk.DeployGate.<init>(DeployGate.java:238)
                                                                                                    	at com.deploygate.sdk.DeployGate.install(DeployGate.java:491)
                                                                                                    	at com.deploygate.sdk.DeployGate.install(DeployGate.java:464)
                                                                                                    	at com.deploygate.sdk.DeployGateProvider.onCreate(DeployGateProvider.java:15)
                                                                                                    	at android.content.ContentProvider.attachInfo(ContentProvider.java:2619)
                                                                                                    	at android.content.ContentProvider.attachInfo(ContentProvider.java:2589)
                                                                                                    	at android.app.ActivityThread.installProvider(ActivityThread.java:7765)
                                                                                                    	at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276) 
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983) 
                                                                                                    	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)

Additional context

trungphammycolor avatar Aug 05 '24 07:08 trungphammycolor

Did you happen to google that? There are a number of stack overflow articles about it.

You haven't provided

  • a description of what you were attempting
  • sample code
  • have you found any other resources
  • etc

Looks like it may be library unrelated. Have you attempted to set that context in your app?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: trungphammycolor @.> Sent: Monday, August 5, 2024 3:16:55 AM To: kenjdavidson/react-native-bluetooth-classic @.> Cc: Subscribed @.***> Subject: [kenjdavidson/react-native-bluetooth-classic] RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts (Issue #336)

Mobile Device Environment Provide a list of operating systems on which this issue is relevant.

  • Device: Google Pixel (Emulator)
  • OS: Android 14 (API level 34)

Application Environment Provide information about your development environment:

  • React Native version: 0.73.0
  • RN Bluetooth Classic version: 1.73.0-rc.12

Describe the bug The app shut down immediately To Reproduce Steps to reproduce the behavior: Build and run app Expected behavior A clear and concise description of what you expected to happen.

Screenshots image.png (view on web)https://github.com/user-attachments/assets/b4a4a4c6-2ddf-4ddb-9270-f4c79ff4ef00 Android studio log:

FATAL EXCEPTION: main Process: com.pangaea.app, PID: 12295 java.lang.RuntimeException: Unable to get provider com.deploygate.sdk.DeployGateProvider: java.lang.SecurityException: com.pangaea.app: 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.installProvider(ActivityThread.java:7770) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983) 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.pangaea.app: 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.deploygate.sdk.DeployGate.prepareBroadcastReceiver(DeployGate.java:273) at com.deploygate.sdk.DeployGate.(DeployGate.java:238) at com.deploygate.sdk.DeployGate.install(DeployGate.java:491) at com.deploygate.sdk.DeployGate.install(DeployGate.java:464) at com.deploygate.sdk.DeployGateProvider.onCreate(DeployGateProvider.java:15) at android.content.ContentProvider.attachInfo(ContentProvider.java:2619) at android.content.ContentProvider.attachInfo(ContentProvider.java:2589) at android.app.ActivityThread.installProvider(ActivityThread.java:7765) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983) 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)

Additional context

— Reply to this email directly, view it on GitHubhttps://github.com/kenjdavidson/react-native-bluetooth-classic/issues/336, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABPMJLYABYEP6I2MKEBY733ZP4RGPAVCNFSM6AAAAABL7WDSIWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2DONZZG43DSMY. You are receiving this because you are subscribed to this thread.Message ID: @.***>

kenjdavidson avatar Aug 05 '24 10:08 kenjdavidson

After a few more looks it does look like I can add it to the library. But I'll need you to confirm adding it resolves the issue, then open a pr for it, if you don't mind.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Kenneth Davidson @.> Sent: Monday, August 5, 2024 6:25:07 AM To: kenjdavidson/react-native-bluetooth-classic @.>; kenjdavidson/react-native-bluetooth-classic @.> Cc: Subscribed @.> Subject: Re: [kenjdavidson/react-native-bluetooth-classic] RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts (Issue #336)

Did you happen to google that? There are a number of stack overflow articles about it.

You haven't provided

  • a description of what you were attempting
  • sample code
  • have you found any other resources
  • etc

Looks like it may be library unrelated. Have you attempted to set that context in your app?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: trungphammycolor @.> Sent: Monday, August 5, 2024 3:16:55 AM To: kenjdavidson/react-native-bluetooth-classic @.> Cc: Subscribed @.***> Subject: [kenjdavidson/react-native-bluetooth-classic] RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts (Issue #336)

Mobile Device Environment Provide a list of operating systems on which this issue is relevant.

  • Device: Google Pixel (Emulator)
  • OS: Android 14 (API level 34)

Application Environment Provide information about your development environment:

  • React Native version: 0.73.0
  • RN Bluetooth Classic version: 1.73.0-rc.12

Describe the bug The app shut down immediately To Reproduce Steps to reproduce the behavior: Build and run app Expected behavior A clear and concise description of what you expected to happen.

Screenshots image.png (view on web)https://github.com/user-attachments/assets/b4a4a4c6-2ddf-4ddb-9270-f4c79ff4ef00 Android studio log:

FATAL EXCEPTION: main Process: com.pangaea.app, PID: 12295 java.lang.RuntimeException: Unable to get provider com.deploygate.sdk.DeployGateProvider: java.lang.SecurityException: com.pangaea.app: 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.installProvider(ActivityThread.java:7770) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983) 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.pangaea.app: 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.deploygate.sdk.DeployGate.prepareBroadcastReceiver(DeployGate.java:273) at com.deploygate.sdk.DeployGate.(DeployGate.java:238) at com.deploygate.sdk.DeployGate.install(DeployGate.java:491) at com.deploygate.sdk.DeployGate.install(DeployGate.java:464) at com.deploygate.sdk.DeployGateProvider.onCreate(DeployGateProvider.java:15) at android.content.ContentProvider.attachInfo(ContentProvider.java:2619) at android.content.ContentProvider.attachInfo(ContentProvider.java:2589) at android.app.ActivityThread.installProvider(ActivityThread.java:7765) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7276) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6983) 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)

Additional context

— Reply to this email directly, view it on GitHubhttps://github.com/kenjdavidson/react-native-bluetooth-classic/issues/336, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABPMJLYABYEP6I2MKEBY733ZP4RGPAVCNFSM6AAAAABL7WDSIWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2DONZZG43DSMY. You are receiving this because you are subscribed to this thread.Message ID: @.***>

kenjdavidson avatar Aug 05 '24 10:08 kenjdavidson

Hello,

Any news of a potential fix ? It has been fixed in other library I use but not this one.

https://developer.android.com/about/versions/14/behavior-changes-14?hl=fr#runtime-receivers-exported

Thank you

bguerinActidel avatar Sep 17 '24 07:09 bguerinActidel

I haven't looked into it, I thought you were going to resolve an open a pr? Since you know how to fix it.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: bguerinActidel @.> Sent: Tuesday, September 17, 2024 3:29:27 AM To: kenjdavidson/react-native-bluetooth-classic @.> Cc: Ken Davidson @.>; Comment @.> Subject: Re: [kenjdavidson/react-native-bluetooth-classic] RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts (Issue #336)

Hello,

Any news of a potential fix ? It has been fixed in other library I use but not this one.

Thank you

— Reply to this email directly, view it on GitHubhttps://github.com/kenjdavidson/react-native-bluetooth-classic/issues/336#issuecomment-2354754814, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABPMJL5CKEW5VLX4GJNNYXLZW7K5PAVCNFSM6AAAAABL7WDSIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJUG42TIOBRGQ. You are receiving this because you commented.Message ID: @.***>

kenjdavidson avatar Sep 19 '24 14:09 kenjdavidson

Hi,

I'm currently in process of updating an app which uses this lib to Android 14, and was expecting to hit this issue - but didn't, things seem to work fine in my case (acceptance testing still ongoing, though). Not sure why, perhaps I'm using the library differently than others above or then there's something different with my test devices. If there's some more details about how to trigger this issue, I'd appreciate the hints.

Anyway, recording an observation here, in case it helps: As I was trying to understand the exact scenario here (I'm not very experienced with Android native stuff), I came to the conclusion that the received intents this lib is registering to are all system broadcast actions, which are apparently exceptions to the new rules. However, as there's folks in this thread who have experienced an issue with this piece of OS changes, I'm a bit puzzled, might well be that my limited Android skills fail me here and I understood the internals of the library wrong.

harriha avatar Dec 04 '24 11:12 harriha