I am seeing the following crash on some devices when registering a background push handler:
Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PlatformException(error, java.lang.Integer cannot be cast to java.lang.Long, null, java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
at com.huawei.hms.flutter.push.PushPlugin.registerBackgroundMessageHandler(PushPlugin.java:369)
at com.huawei.hms.flutter.push.PushPlugin.onMethodCall(PushPlugin.java:170)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8349)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
)
This doesn't happen on cloud debugging and only seems to affect less than 5% of users.
I am trying the following change to line 369 of PushPlugin.java to see if that resolves it:
Change
long userCallbackHandle = Objects.requireNonNull(call.argument("rawCallback"));
to
long userCallbackHandle = ((Number) Objects.requireNonNull(call.argument("rawCallback"))).longValue();
I am seeing the following crash on some devices when registering a background push handler:
This doesn't happen on cloud debugging and only seems to affect less than 5% of users.
I am trying the following change to line 369 of PushPlugin.java to see if that resolves it: Change
to