airship-flutter icon indicating copy to clipboard operation
airship-flutter copied to clipboard

Airship initialization code stopping methodChannel of Flutter module

Open gauravgupta188 opened this issue 1 year ago • 2 comments

Hi Team,

Effected Airship Version : 7.5.0

We are using Airship_Flutter with another method channel . After airship initialization code, one of my method channel stopped working. When we commented airship code , method channel started working.

Airship.takeOff(config); Airship.push.android.setBackgroundPushReceivedHandler(backgroundMessageHandler);

These two lines are stopping method channel. On Click on one button, We are calling this line in Android.

ValidicPackagePlugin.methodChannel.invokeMethod("result",nativeData)

Same kind of issue was in Firebase Messaging . Kindly check this ticket

https://github.com/firebase/flutterfire/issues/9689

Solution was available on this ticket.

https://github.com/firebase/flutterfire/issues/9446#issuecomment-1240554285

They come with solutions that i tried on airship code too. It is not working with airship_flutter

@pragma('vm:entry-point') Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async { // handle message }

I tried same with airship_flutter and it is not working.

@pragma('vm:entry-point') Future backgroundMessageHandler(PushReceivedEvent event) async { debugPrint("Background Push Received $event"); }

Any support will be highly appreciated.

gauravgupta188 avatar Jul 03 '24 12:07 gauravgupta188

That fix is if its always broken in release mode which we might need still. I think this might be a possible solution - https://github.com/la-haus/flutter-twilio-conversations/pull/4

This might take us some time to figure out if its not just a mismatch of attach/detach calls

rlepinski avatar Jul 03 '24 16:07 rlepinski

Hi @rlepinski

Thanks for your response.

I checked this fix earlier and implemented in my case. But it was not working.

Currently I just comment out this line and my method channel is working fine.

Airship.push.android.setBackgroundPushReceivedHandler(backgroundMessageHandler);

This issue looks not related to onAttachedToEngine. Let me know , if you know more details. My code base is too big , so giving sample code is not feasible.

gauravgupta188 avatar Jul 04 '24 05:07 gauravgupta188

Closing due to inactivity, feel free to reopen if you're still having this issue

crow avatar Feb 06 '25 22:02 crow