Open lippytak opened 1 year ago
I have the same issue here, it works on iOS but doesn't work in Android.
Me too, still there is no solution?
I have noticed that if we comment out the below service from "@capacitor/push-notifications/android/src/main/AndroidManifest.xml" it fix Intercom push issue but normal notification from FCM will not work
`
</service>
`
Maybe that will help fining a proper solution
Did anyone solve this issue?
Hi Guys, I was experiencing this issue as well and managed to get it working in my app!
When looking trough the intercom push notifications documentation I noticed this step mentioning some extra configration that is needed when using intercom with other FCM setups.
As far as I understand it the @capacitor/push-notifications
plugin and the capacitor-community/intercom
plugin both try to handle incoming notifications and are thus overwriting each other or something like that.
I solved this by adding some custom native code to my android package which catches the push notification and hands it over to the correct plugin:
CustomMessagingPlugin.java
to android/app/src/main/java/<com>/<appname>/<app>
(This should be the same place where the MainActivity.java file is located)package <YOUR_PACKAGE_NAME (com.appname.app)>;
import android.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import java.util.Map;
import io.intercom.android.sdk.push.IntercomPushClient;
public class CustomMessagingPlugin extends FirebaseMessagingService {
private final IntercomPushClient intercomPushClient = new IntercomPushClient();
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Map message = remoteMessage.getData();
if (intercomPushClient.isIntercomPush(message)) {
intercomPushClient.handlePush(getApplication(), message);
} else {
super.onMessageReceived(remoteMessage);
}
}
}
AndroidManifest.xml
(As a child of <application>
)<service android:name=".CustomMessagingPlugin" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
At the top of the file
apply plugin: 'com.google.gms.google-services'
Inside dependencies
implementation 'io.intercom.android:intercom-sdk:10.6.1'
implementation "com.google.firebase:firebase-messaging:$firebaseMessagingVersion"
This probalbly isn't the best way to fix this but at least it works 🤷♂️
This probably also fixes #84
I am not able to get them working on iOS neither. Getting the error: Intercom.sendPushTokenToIntercom()" is not implemented on ios
. Could anyone share the code to get iOS working?
Our app has both OneSignal and Intercom. OneSignal works fine, Intercom pushes do not (ios nor android). The patch above by Emieldv caused our app to crash as soon as you launched intercom interface. We did consider the versions in his patch to be outdated and updated accordingly, but to no avail. Intercom push configuration is setup exactly the same as our OneSignal. We have an older cordova app using the same configs, but leveraging the cordova-plugin-intercom and calling intercom.registerPush(), and that works fine. Is there a reason this package uses @capacitor/push-notifications vs Intercom.registerPush()?
Is there a reason this package uses @capacitor/push-notifications vs Intercom.registerPush()?
not that I recall. That would be a reasonable change.
we use onesignal too, so this plugin is unusable for us until then. maybe code from https://github.com/intercom/intercom-cordova can be looked at to speed things up on this plugin
Just FYI to everyone, I forked it here and it's working for me, it's a bit rough in implementation so I advise to be careful and totally reinstall it, as I branched it from a pending PR I already submitted to this repo. https://github.com/capacitor-community/intercom/pull/113
https://github.com/aquipa/capacitor-intercom/tree/notifications-working
Describe the bug I'm unable to get push notifications working on Android. I'm guessing this is a config/setup issue, but since this issue has come up a few times I was hoping to get it working and then contribute better instructions to this repo.
To Reproduce
Expected: Receive a push notification on the device after ~10 seconds.
Result: Nothing. The message comes through as expected if you resume the app.
Additional context
Platforms:
Any help greatly appreciated!