From 57930fe3c8e15fcd15055c331fee27ade18f8e9e Mon Sep 17 00:00:00 2001 From: Kurogoma4D Date: Thu, 20 Jan 2022 16:47:14 +0900 Subject: [PATCH] modify: change processing order on initialize FlutterEngine --- .../app/background_locator/IsolateHolderExtension.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android/src/main/kotlin/rekab/app/background_locator/IsolateHolderExtension.kt b/android/src/main/kotlin/rekab/app/background_locator/IsolateHolderExtension.kt index 9c0f65d0..02d9f84c 100644 --- a/android/src/main/kotlin/rekab/app/background_locator/IsolateHolderExtension.kt +++ b/android/src/main/kotlin/rekab/app/background_locator/IsolateHolderExtension.kt @@ -19,16 +19,16 @@ internal fun IsolateHolderService.startLocatorService(context: Context) { this.context = context if (IsolateHolderService.backgroundEngine == null) { + // We need flutter engine to handle callback, so if it is not available we have to create a + // Flutter engine without any view + IsolateHolderService.backgroundEngine = FlutterEngine(context) + val callbackHandle = context.getSharedPreferences( Keys.SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE) .getLong(Keys.CALLBACK_DISPATCHER_HANDLE_KEY, 0) val callbackInfo = FlutterCallbackInformation.lookupCallbackInformation(callbackHandle) - // We need flutter engine to handle callback, so if it is not available we have to create a - // Flutter engine without any view - IsolateHolderService.backgroundEngine = FlutterEngine(context) - val args = DartExecutor.DartCallback( context.assets, FlutterInjector.instance().flutterLoader().findAppBundlePath(),