diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a4d07cd2..9aa6b869e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Changed the Android notification channel name to `Notification channel`. It can be renamed by defining the `notification_channel_name` resource string.
+### Added
+
+- Added support for Android 14.
+
## [3.3.2] - 23-12-12
### Fixed
diff --git a/android/build.gradle b/android/build.gradle
index f875c5dd0..0569eb089 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -5,8 +5,8 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.2.2'
- classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21'
+ classpath 'com.android.tools.build:gradle:7.4.2'
+ classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21'
}
}
@@ -29,11 +29,11 @@ def enabledCast = safeExtGet("THEOplayer_extensionCast", 'false').toBoolean()
def enabledMediaSession = safeExtGet("THEOplayer_extensionMediaSession", 'true').toBoolean()
android {
- compileSdk safeExtGet('THEOplayer_compileSdkVersion', 33)
+ compileSdk safeExtGet('THEOplayer_compileSdkVersion', 34)
defaultConfig {
minSdkVersion safeExtGet('THEOplayer_minSdkVersion', 21)
- targetSdkVersion safeExtGet('THEOplayer_targetSdkVersion', 33)
+ targetSdkVersion safeExtGet('THEOplayer_targetSdkVersion', 34)
versionCode 1
versionName "1.0"
@@ -101,7 +101,7 @@ repositories {
dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
implementation "androidx.appcompat:appcompat:1.6.1"
// The minimum supported THEOplayer version is 6.0.0
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index f2406d42d..9c5689bef 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -25,6 +25,15 @@
-->
+
+
+
diff --git a/android/src/main/java/com/theoplayer/presentation/PipUtils.kt b/android/src/main/java/com/theoplayer/presentation/PipUtils.kt
index 25d1688db..f0e9b5727 100644
--- a/android/src/main/java/com/theoplayer/presentation/PipUtils.kt
+++ b/android/src/main/java/com/theoplayer/presentation/PipUtils.kt
@@ -1,5 +1,6 @@
package com.theoplayer.presentation
+import android.annotation.SuppressLint
import android.app.PendingIntent
import android.app.PictureInPictureParams
import android.app.RemoteAction
@@ -68,6 +69,7 @@ class PipUtils(
}
}
+ @SuppressLint("UnspecifiedRegisterReceiverFlag")
fun enable() {
if (enabled) {
return
@@ -78,10 +80,19 @@ class PipUtils(
adEvents.forEach { action ->
player.ads.addEventListener(action, onAdAction)
}
- reactContext.currentActivity?.registerReceiver(
- broadcastReceiver,
- IntentFilter(ACTION_MEDIA_CONTROL)
- )
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ reactContext.currentActivity?.registerReceiver(
+ broadcastReceiver,
+ IntentFilter(ACTION_MEDIA_CONTROL), Context.RECEIVER_EXPORTED
+ )
+ } else {
+ reactContext.currentActivity?.registerReceiver(
+ broadcastReceiver,
+ IntentFilter(ACTION_MEDIA_CONTROL)
+ )
+ }
+
enabled = true
}
diff --git a/android/src/main/java/com/theoplayer/presentation/PresentationManager.kt b/android/src/main/java/com/theoplayer/presentation/PresentationManager.kt
index 24f3ef928..eb33b3418 100644
--- a/android/src/main/java/com/theoplayer/presentation/PresentationManager.kt
+++ b/android/src/main/java/com/theoplayer/presentation/PresentationManager.kt
@@ -1,5 +1,6 @@
package com.theoplayer.presentation
+import android.annotation.SuppressLint
import android.app.AppOpsManager
import android.content.BroadcastReceiver
import android.content.Context
@@ -18,6 +19,7 @@ import com.theoplayer.android.api.error.ErrorCode
import com.theoplayer.android.api.error.THEOplayerException
import com.theoplayer.android.api.player.PresentationMode
+@SuppressLint("UnspecifiedRegisterReceiverFlag")
class PresentationManager(
private val viewCtx: ReactTHEOplayerContext,
private val reactContext: ThemedReactContext,
@@ -58,12 +60,27 @@ class PresentationManager(
supportsPip =
reactContext.packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)
}
- reactContext.currentActivity?.registerReceiver(
- onUserLeaveHintReceiver, IntentFilter("onUserLeaveHint")
- )
- reactContext.currentActivity?.registerReceiver(
- onPictureInPictureModeChanged, IntentFilter("onPictureInPictureModeChanged")
- )
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ reactContext.currentActivity?.registerReceiver(
+ onUserLeaveHintReceiver, IntentFilter("onUserLeaveHint"), Context.RECEIVER_EXPORTED
+ )
+ } else {
+ reactContext.currentActivity?.registerReceiver(
+ onUserLeaveHintReceiver, IntentFilter("onUserLeaveHint")
+ )
+ }
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ reactContext.currentActivity?.registerReceiver(
+ onPictureInPictureModeChanged, IntentFilter("onPictureInPictureModeChanged"),
+ Context.RECEIVER_EXPORTED
+ )
+ } else {
+ reactContext.currentActivity?.registerReceiver(
+ onPictureInPictureModeChanged, IntentFilter("onPictureInPictureModeChanged")
+ )
+ }
}
fun destroy() {
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index 11dcce428..d01f04a66 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -155,16 +155,15 @@ android {
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
- implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation project(path: ':reactnativetheoplayer')
implementation "com.google.android.gms:play-services-cast-framework:${safeExtGet('castFrameworkVersion', '+')}"
- debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
- debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
+ debugImplementation("com.facebook.flipper:flipper:0.242.0")
+ debugImplementation("com.facebook.flipper:flipper-network-plugin:0.242.0") {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
- debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
+ debugImplementation("com.facebook.flipper:flipper-fresco-plugin:0.182.0")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
diff --git a/example/android/app/src/main/java/com/reactnativetheoplayer/MainActivity.java b/example/android/app/src/main/java/com/reactnativetheoplayer/MainActivity.java
index 46464b707..44df51969 100644
--- a/example/android/app/src/main/java/com/reactnativetheoplayer/MainActivity.java
+++ b/example/android/app/src/main/java/com/reactnativetheoplayer/MainActivity.java
@@ -3,8 +3,11 @@
import android.content.Intent;
import android.content.res.Configuration;
import android.media.AudioManager;
+import android.os.Build;
import android.os.Bundle;
+import androidx.annotation.NonNull;
+
import com.facebook.react.ReactActivity;
import com.google.android.gms.cast.framework.CastContext;
@@ -40,8 +43,10 @@ public void onUserLeaveHint () {
}
@Override
- public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
- super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig);
+ public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, @NonNull Configuration newConfig) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig);
+ }
Intent intent = new Intent("onPictureInPictureModeChanged");
intent.putExtra("isInPictureInPictureMode", isInPictureInPictureMode);
this.sendBroadcast(intent);
diff --git a/example/android/build.gradle b/example/android/build.gradle
index 20302e15b..e393a00a3 100644
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -2,20 +2,20 @@
buildscript {
ext {
- buildToolsVersion = "30.0.3"
+ buildToolsVersion = "34.0.0"
minSdkVersion = 24
- compileSdkVersion = 33
- targetSdkVersion = 33
+ compileSdkVersion = 34
+ targetSdkVersion = 34
ndkVersion = "23.1.7779620"
- castFrameworkVersion = "21.0.1"
+ castFrameworkVersion = "21.4.0"
}
repositories {
google()
mavenCentral()
}
dependencies {
- classpath("com.android.tools.build:gradle:4.2.2")
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
+ classpath("com.android.tools.build:gradle:7.4.2")
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21")
classpath("com.facebook.react:react-native-gradle-plugin")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 5d4a31a0d..d918516b3 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -24,9 +24,6 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
-# Version of flipper SDK to use with React Native
-FLIPPER_VERSION=0.142.0
-
# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew -PreactNativeArchitectures=x86_64