From bb7782652fed965ba777f1dbe2e7498ebe03ba58 Mon Sep 17 00:00:00 2001 From: "f.godino" Date: Tue, 8 Apr 2025 11:35:23 +0200 Subject: [PATCH 1/2] update gradle version --- flutter-hms-push/android/build.gradle | 2 +- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flutter-hms-push/android/build.gradle b/flutter-hms-push/android/build.gradle index 9b85dfaf..7ff9d493 100644 --- a/flutter-hms-push/android/build.gradle +++ b/flutter-hms-push/android/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath "com.android.tools.build:gradle:3.6.0" + classpath 'com.android.tools.build:gradle:7.4.2' } } diff --git a/flutter-hms-push/android/gradle/wrapper/gradle-wrapper.properties b/flutter-hms-push/android/gradle/wrapper/gradle-wrapper.properties index ed8c93de..5a6b73d6 100644 --- a/flutter-hms-push/android/gradle/wrapper/gradle-wrapper.properties +++ b/flutter-hms-push/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip From c0cd17c7b2b7bc5973a65bc9eba3b8a8a2fad951 Mon Sep 17 00:00:00 2001 From: "f.godino" Date: Tue, 8 Apr 2025 12:30:07 +0200 Subject: [PATCH 2/2] fix push plugin for flutter 3.29 android error build --- .../BackgroundMessagingService.java | 7 ------- .../FlutterBackgroundRunner.java | 20 ++----------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/BackgroundMessagingService.java b/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/BackgroundMessagingService.java index f518c7ae..516b18d9 100644 --- a/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/BackgroundMessagingService.java +++ b/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/BackgroundMessagingService.java @@ -24,8 +24,6 @@ import androidx.annotation.NonNull; import androidx.core.app.JobIntentService; -import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback; - import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -44,11 +42,6 @@ private synchronized void setBackgroundRunner(FlutterBackgroundRunner bgRunner) BackgroundMessagingService.backgroundRunner = bgRunner; } - // For Backwards Compatibility with V1 Plugin registration. - public static void setPluginRegistrantCallback(final PluginRegistrantCallback callback) { - FlutterBackgroundRunner.setPluginRegistrantCallback(callback); - } - public static void setUserCallback(final Context context, final long userCallback) { FlutterBackgroundRunner.setUserCallback(context, userCallback); } diff --git a/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/FlutterBackgroundRunner.java b/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/FlutterBackgroundRunner.java index 01659045..945437ff 100644 --- a/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/FlutterBackgroundRunner.java +++ b/flutter-hms-push/android/src/main/java/com/huawei/hms/flutter/push/backgroundmessaging/FlutterBackgroundRunner.java @@ -38,13 +38,11 @@ import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.embedding.engine.dart.DartExecutor.DartCallback; import io.flutter.embedding.engine.loader.FlutterLoader; -import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; -import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback; import io.flutter.view.FlutterCallbackInformation; import java.util.Arrays; @@ -60,9 +58,6 @@ public class FlutterBackgroundRunner implements MethodCallHandler { public static final String USER_CALLBACK_KEY = "push_background_message_callback"; - // Deprecated, Support for backwards compatibility with V1 embedding. - private static PluginRegistrantCallback pluginRegistrantCallback; - private final AtomicBoolean isCallbackDispatcherReady = new AtomicBoolean(false); private MethodChannel bgMethodChannel; @@ -71,11 +66,6 @@ public class FlutterBackgroundRunner implements MethodCallHandler { private long bgMessagingCallback; - // For Backwards Compatibility with V1 Plugin registration. - public static void setPluginRegistrantCallback(final PluginRegistrantCallback callback) { - pluginRegistrantCallback = callback; - } - public static void setCallBackDispatcher(final Context context, final long callbackHandle) { final SharedPreferences prefs = context.getSharedPreferences(Core.PREFERENCE_NAME, Context.MODE_PRIVATE); prefs.edit().putLong(CALLBACK_DISPATCHER_KEY, callbackHandle).apply(); @@ -123,17 +113,11 @@ public void startBgIsolate(final Context context, final long callbackHandle) { flutterEngine = new FlutterEngine(context); final FlutterCallbackInformation flutterCallbackInfo - = FlutterCallbackInformation.lookupCallbackInformation(callbackHandle); + = FlutterCallbackInformation.lookupCallbackInformation(callbackHandle); final DartExecutor executor = flutterEngine.getDartExecutor(); initializeMethodChannel(executor); final DartCallback dartCallback = new DartCallback(assets, appBundlePath, flutterCallbackInfo); executor.executeDartCallback(dartCallback); - - // For V1 Embedding - if (pluginRegistrantCallback != null) { - pluginRegistrantCallback.registerWith(new ShimPluginRegistry(flutterEngine)); - } - } }); }; @@ -168,7 +152,7 @@ public void onMethodCall(@NonNull final MethodCall call, @NonNull final Result r public void executeDartCallbackInBgIsolate(final Intent intent, final CountDownLatch latch) { if (flutterEngine == null) { Log.i(TAG, - "A background message could not be handled in Dart as no onBackgroundLocation handler has been registered"); + "A background message could not be handled in Dart as no onBackgroundLocation handler has been registered"); return; } Result result = null;