Android applications with Android 12 and above that uses the published AAR will crash upon startup without the required RECEIVER_EXPORTED flags, declared upon registering receivers in intent filters. Errors are as shown below:
Java.Lang.SecurityException: com.company.app: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
---> Android.OS.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:16680)
at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:11613)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2961)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3199)
at android.os.Binder.execTransactInternal(Binder.java:1375)
--- End of managed Android.OS.RemoteException stack trace ---
android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:16680)
at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:11613)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2961)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3199)
at android.os.Binder.execTransactInternal(Binder.java:1375)
--- End of managed Android.OS.RemoteException stack trace ---
android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:16680)
at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:11613)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2961)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3199)
at android.os.Binder.execTransactInternal(Binder.java:1375)
--- End of inner exception stack trace ---
Android applications with Android 12 and above that uses the published AAR will crash upon startup without the required RECEIVER_EXPORTED flags, declared upon registering receivers in intent filters. Errors are as shown below:
A similar, solved incident was reported here: https://github.com/doublesymmetry/react-native-track-player/issues/2327
This PR adds the required RECEIVER_EXPORTED flags. Published as AAR and tested in my own application.