Doesn't receive Push Notifications on Android
See original GitHub issueHello, First off, thanks for a great library!
98% of the implementation went swiftly and easily but getting pushes to show up has shown itself to be impossible (for me at least).
Problem
To repeat, the problem is that I can’t get push notifications sent from Intercom to show up on an Android device. In App messages work fine and all the other features. The user used for testing is verified to be accepting pushes and we’re sending the push tokens to Intercom like this:
FCM.getFCMToken().then(pushToken => {
if (pushToken) {
// Send to internal backend push service
this.props.postUserPush(pushToken, 'fcm')
Intercom.sendTokenToIntercom(pushToken)
}
})
And when running adb logcat
I’m seeing MessagingService: Remote message received
when sending pushes from Intercom. Which I interpret as the push arriving at the device but something blocks it from showing up, ergo some problem with my implementation. But I can’t for the life of me figure out what’s wrong.
Environment
We have an existing Push Notification setup using react-native-fcm
which is verified to be receiving pushes from our own Push Service as before.
Some code
build.gradle
...
compileSdkVersion 26
buildToolsVersion "26.0.2"
...
minSdkVersion 16
targetSdkVersion 23
...
...
compile project(':react-native-fcm')
compile 'com.google.firebase:firebase-core:11.+'
...
compile 'io.intercom.android:intercom-sdk-base:4.+'
compile 'io.intercom.android:intercom-sdk-fcm:4.+'
compile 'com.google.firebase:firebase-messaging:11.+'
AndroidManifest.xml
...
<service android:name="com.robinpowered.react.Intercom.IntercomIntentService" android:exported="false">
<intent-filter android:priority="999">
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<receiver android:name="io.intercom.android.sdk.push.IntercomPushBroadcastReceiver" tools:replace="android:exported" android:exported="true" />
<service android:name="com.evollu.react.fcm.MessagingService" android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name="com.evollu.react.fcm.InstanceIdService" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
...
Any help or guidance would be greatly appreciated!
Issue Analytics
- State:
- Created 6 years ago
- Comments:33 (1 by maintainers)
Top GitHub Comments
I fixed this issue by overriding the MessagingService of the
react-native-fcm
library. This gives the effect of IntercomIntentService not being used since the push handling happens in the class OverriddenMessagingService (just an example name).Example:
@vvusts - ha, nope - I realised that a couple hours after I implemented this…
I moved the creation of the channels to native land and now I can. So in my
MainApplication.java
I now have: