New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Android push intercepting technique #192
Change Android push intercepting technique #192
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting...
But need to test this first.
intercom_flutter/android/src/main/java/io/maido/intercom/PushInterceptReceiver.kt
Show resolved
Hide resolved
1dbf6af
to
0159b20
Compare
@deepak786 feel free to test it and merge whenever you feel comfortable with the change, I myself already using this change for over a year in production now and never experienced an issue |
@mabdurrahman Thank you for this PR. |
@mabdurrahman I tested this change on Android.
could be this issue #151. |
The new push intercept receiver is meant to work on parallel to Firebase Messaging service
0159b20
to
4d68d75
Compare
@deepak786 Sorry for the delay, I was actually migrating my app to flutter 2 and wasn't able to test earlier, after testing I confirm I can get the exact same behavior as yours, however, I believe you're correct about relating that issue to #150 and I'm confident that it's not really related to the change proposed by this PR. Moreover, after I migrated my app to flutter 2 and the new Firebase Messaging I discovered that Firebase Messaging itself is doing the exact same thing proposed by this PR (more details here), and it even takes it a step further by declaring the broadcast receiver though the plugin's |
@mabdurrahman Currently, the users can display a manual notification or can ignore the background notification. I see no issue with your PR. |
@deepak786 Hey, sorry for the delays again, I've raised the issue this morning with Intercom support, however, I think it might delay anyway because of the holidays season, let's hope for the best. As for the changes in the Anyway, if you still insist on having the change on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that need to be done in the readME. But I think it can be done separately.
Issue
I'm using this plugin from early days on a Flutter 1 project along with the old FlutterFire - Cloud Messaging, however, as you might know already that the old FlutterFire - Cloud Messaging wasn't working on background properly (i.e. FlutterFire#4269, FlutterFire#5697, FlutterFire#5387, and more...) and I wasn't able to get the Intercom Plugin to handle the FCM messages on the background as being mentioned on the README.md,
Solution
As a result of the mentioned issue, I had to fork this plugin and use a different technique to intercept FCM messages in a way that doesn't conflict with FlutterFire implementation at all, and it's working perfectly since then (almost over a year in production).
The solution is basically to replace the
io.maido.intercom.PushInterceptService
withio.maido.intercom.PushInterceptReceiver
, because only one push notification service can work at a time (either FlutterFire's one, or this plugin's one) on contrary to the broadcast receivers which can co-exist next to each other without any conflicts.