From d73c37a8f2cf418350d4ab0caf37cdafe26bccd3 Mon Sep 17 00:00:00 2001 From: Ryan Heise Date: Wed, 28 Dec 2022 01:00:18 +1100 Subject: [PATCH] Fix cache bug in AudioServiceFragmentActivity (@Mordtimer). --- audio_service/CHANGELOG.md | 1 + .../audioservice/AudioServiceFragmentActivity.java | 8 ++++++++ .../android/app/src/main/AndroidManifest.xml | 11 ++++++++++- .../android/app/src/main/res/values/styles.xml | 14 ++++++++++++-- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/audio_service/CHANGELOG.md b/audio_service/CHANGELOG.md index 8dd6a79f..f1f93838 100644 --- a/audio_service/CHANGELOG.md +++ b/audio_service/CHANGELOG.md @@ -1,5 +1,6 @@ ## 0.18.9 +* Fix cache bug in AudioServiceFragmentActivity (@Mordtimer). * Add Android Auto manifest entry for example app (@ColinSchmale). ## 0.18.8 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 a7f9f8ba..59a71db2 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 @@ -2,8 +2,10 @@ import android.content.Context; +import android.os.Bundle; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import io.flutter.embedding.android.FlutterFragmentActivity; import io.flutter.embedding.engine.FlutterEngine; @@ -13,6 +15,12 @@ public FlutterEngine provideFlutterEngine(@NonNull Context context) { return AudioServicePlugin.getFlutterEngine(context); } + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + AudioServicePlugin.getFlutterEngine(this); + super.onCreate(savedInstanceState); + } + @Override protected String getCachedEngineId() { AudioServicePlugin.getFlutterEngine(this); diff --git a/audio_service/example/android/app/src/main/AndroidManifest.xml b/audio_service/example/android/app/src/main/AndroidManifest.xml index fae9023f..ccc1a255 100644 --- a/audio_service/example/android/app/src/main/AndroidManifest.xml +++ b/audio_service/example/android/app/src/main/AndroidManifest.xml @@ -11,16 +11,25 @@ + + diff --git a/audio_service/example/android/app/src/main/res/values/styles.xml b/audio_service/example/android/app/src/main/res/values/styles.xml index 00fa4417..cb1ef880 100644 --- a/audio_service/example/android/app/src/main/res/values/styles.xml +++ b/audio_service/example/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + +