ghenry22 / cordova-plugin-music-controls2

A Cordova plugin displaying music controls in notifications (cordova-plugin-music-controls)
MIT License
59 stars 60 forks source link

Android 14 (SDK 34) new security requirements #104

Open EltonFaust opened 4 months ago

EltonFaust commented 4 months ago

Android 14 had some security changes when register an broadcast receiver and when is created an mutable PendingIntent, this is throwing and exception preventing this plugin to work.

System.err: java.lang.SecurityException: net.my.cordova.app: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

Note: android.content.Context#registerReceiver only received a flags param on android SDK 26, so I split the registration of the broadcast receivers, only passing the flag to the affected version.

ddurham2 commented 3 months ago

@EltonFaust , thanks for this change! I cherry picked it in my fork of this repo. I hope @ghenry22 will choose to merge it. Apps that target SDK 34 (now required by the play store) crash without the change.