urbanairship / airship-flutter

Flutter integration
Other
17 stars 18 forks source link

Airship initialization code stopping methodChannel of Flutter module #207

Open gauravgupta188 opened 1 month ago

gauravgupta188 commented 1 month ago

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.

rlepinski commented 1 month ago

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

gauravgupta188 commented 1 month ago

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.