diff --git a/android/build.gradle b/android/build.gradle index c7c4b03e21..4c8a9cbd98 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -150,6 +150,8 @@ dependencies { //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" + implementation "androidx.core:core:1.9.0" + // For media playback using ExoPlayer implementation "androidx.media3:media3-exoplayer:$media3_version" diff --git a/android/src/main/java/com/brentvatne/receiver/AudioBecomingNoisyReceiver.java b/android/src/main/java/com/brentvatne/receiver/AudioBecomingNoisyReceiver.java index 82f8e28ca0..1b0fb0deb1 100644 --- a/android/src/main/java/com/brentvatne/receiver/AudioBecomingNoisyReceiver.java +++ b/android/src/main/java/com/brentvatne/receiver/AudioBecomingNoisyReceiver.java @@ -6,6 +6,8 @@ import android.content.IntentFilter; import android.media.AudioManager; +import androidx.core.content.ContextCompat; + public class AudioBecomingNoisyReceiver extends BroadcastReceiver { private final Context context; @@ -25,7 +27,7 @@ public void onReceive(Context context, Intent intent) { public void setListener(BecomingNoisyListener listener) { this.listener = listener; IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY); - context.registerReceiver(this, intentFilter); + ContextCompat.registerReceiver(context, this, intentFilter, ContextCompat.RECEIVER_NOT_EXPORTED); } public void removeListener() {