diff --git a/audio_service/CHANGELOG.md b/audio_service/CHANGELOG.md index 5171d412..ba3f1965 100644 --- a/audio_service/CHANGELOG.md +++ b/audio_service/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.18.15 + +* Add deep link support for FlutterFragmentActivity (@jan-milovanovic). +* Fix JDK 21 compile error. + ## 0.18.14 * Support rxdart 0.28.x. diff --git a/audio_service/android/build.gradle b/audio_service/android/build.gradle index c33a63d8..7bc3e3ee 100644 --- a/audio_service/android/build.gradle +++ b/audio_service/android/build.gradle @@ -1,6 +1,6 @@ group 'com.ryanheise.audioservice' version '1.0-SNAPSHOT' -def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] +def args = ["-Xlint:deprecation","-Xlint:unchecked"] buildscript { repositories { diff --git a/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioServiceFragmentActivity.java b/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioServiceFragmentActivity.java index 59a71db2..723fbbaa 100644 --- a/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioServiceFragmentActivity.java +++ b/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioServiceFragmentActivity.java @@ -33,4 +33,16 @@ protected String getCachedEngineId() { public boolean shouldDestroyEngineWithHost() { return false; } + + // Make this protected method public + @Override + public String getInitialRoute() { + return super.getInitialRoute(); + } + + // Make this protected method public + @Override + public boolean shouldHandleDeeplinking() { + return super.shouldHandleDeeplinking(); + } } diff --git a/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioServicePlugin.java b/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioServicePlugin.java index bbfe877b..b776a840 100644 --- a/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioServicePlugin.java +++ b/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioServicePlugin.java @@ -37,6 +37,7 @@ import java.util.concurrent.Executors; import io.flutter.embedding.android.FlutterActivity; +import io.flutter.embedding.android.FlutterFragmentActivity; import io.flutter.embedding.engine.plugins.FlutterPlugin; import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; import io.flutter.embedding.engine.plugins.activity.ActivityAware; @@ -87,6 +88,20 @@ public static synchronized FlutterEngine getFlutterEngine(Context context) { } } } + } else if (context instanceof AudioServiceFragmentActivity) { + final AudioServiceFragmentActivity activity = (AudioServiceFragmentActivity)context; + initialRoute = activity.getInitialRoute(); + if (initialRoute == null) { + if (activity.shouldHandleDeeplinking()) { + Uri data = activity.getIntent().getData(); + if (data != null) { + initialRoute = data.getPath(); + if (data.getQuery() != null && !data.getQuery().isEmpty()) { + initialRoute += "?" + data.getQuery(); + } + } + } + } } if (initialRoute == null) { initialRoute = "/"; diff --git a/audio_service/example/android/app/build.gradle b/audio_service/example/android/app/build.gradle index 03e4d096..3cad2d3f 100644 --- a/audio_service/example/android/app/build.gradle +++ b/audio_service/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { namespace 'com.ryanheise.audioserviceexample' - compileSdkVersion 33 + compileSdkVersion 34 lintOptions { disable 'InvalidPackage' @@ -35,7 +35,7 @@ android { defaultConfig { applicationId "com.ryanheise.audioserviceexample" minSdkVersion 21 - targetSdkVersion 33 + targetSdkVersion 34 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/audio_service/example/android/app/src/main/AndroidManifest.xml b/audio_service/example/android/app/src/main/AndroidManifest.xml index 98957399..03210098 100644 --- a/audio_service/example/android/app/src/main/AndroidManifest.xml +++ b/audio_service/example/android/app/src/main/AndroidManifest.xml @@ -5,8 +5,7 @@ - - + diff --git a/audio_service/example/android/build.gradle b/audio_service/example/android/build.gradle index b8e955ca..95adc21a 100644 --- a/audio_service/example/android/build.gradle +++ b/audio_service/example/android/build.gradle @@ -14,13 +14,6 @@ allprojects { google() mavenCentral() } - - gradle.projectsEvaluated { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:deprecation" - options.compilerArgs << "-Xlint:unchecked" - } - } } rootProject.buildDir = '../build' @@ -34,3 +27,11 @@ subprojects { tasks.register("clean", Delete) { delete rootProject.buildDir } + +gradle.projectsEvaluated { + project(":audio_service") { + tasks.withType(JavaCompile) { + options.compilerArgs << "-Werror" + } + } +} diff --git a/audio_service/pubspec.yaml b/audio_service/pubspec.yaml index 49f1f6dd..0e394a12 100644 --- a/audio_service/pubspec.yaml +++ b/audio_service/pubspec.yaml @@ -1,6 +1,6 @@ name: audio_service description: Flutter plugin to play audio in the background while the screen is off. -version: 0.18.14 +version: 0.18.15 repository: https://github.com/ryanheise/audio_service/tree/minor/audio_service issue_tracker: https://github.com/ryanheise/audio_service/issues topics: