1

Our app is running on React Native.
I have 2 scenarios:

  1. Firebase/messaging is implemented
  • when I trigger the Push Notification directly from our firebase (development) I am able to receive notification but when the Push Notification is triggered from sfmc I am not receiving any notification
  1. Firebase/messaging is not implemented
  • when I trigger the Push Notification, either in sfmc or from our firebase (development) I am able to receive the notification

As the title, I am not receiving Push Notification when it is triggered in sfmc. I am wondering if I missed something in my fcm implementation regarding the communication between sfmc and fcm. I've also read some of the question that is similar to my concern, but they are more on the migration from gcm to fcm. I've also checked the logs to make sure that push_enabled is set to true.

I've searched and searched and I cannot find any answers. Is there any other setup that have I missed ?

2 Answers 2

0

99.999% of the time customers fail to follow the multiple push provider implementation instructions (ref. https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/trouble-shooting/multiple-push-sdks.html)

4
  • The documentation you mentioned I think this is for native implementation, by chance do you know if they have documentation for ReactNative ? Thanks Commented Jan 6, 2022 at 0:34
  • You must implement the required code in native classes. We've given you the cut & paste code, but we can't do it for you. There's no way to know how you've implemented the service (or what the plugin you're using is doing).
    – Bill Mote
    Commented Jan 6, 2022 at 14:15
  • @BillMote we are facing the same issue, native implementation seems fine, device is registering and in-app message is working fine, but push notification is not receiving. We are using single push provider sfmc. Commented Jan 9 at 6:43
  • Our React plugin works out-of-the-box to receive and display push notifications. If you're finding this not to be true: open a support case and we'll help you figure out where you've gone awry with your implementation.
    – Bill Mote
    Commented Jan 9 at 20:05
0

We fixed this by adding a custom notification service:

yourReactNativeApp/android/app/src/main/java/com/your/yourApp/NotificationService.java

package com.your.app;

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.salesforce.marketingcloud.messages.push.PushMessageManager;
import io.invertase.firebase.messaging.ReactNativeFirebaseMessagingService;
import com.salesforce.marketingcloud.MarketingCloudSdk;

public class NotificationService extends FirebaseMessagingService {

    public NotificationService() {}

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        //https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/trouble-shooting/multiple-push-sdks.html
        if (PushMessageManager.isMarketingCloudPush(remoteMessage)){
            //handle Marketing Cloud
            MarketingCloudSdk.requestSdk((marketingCloudSdk -> marketingCloudSdk.getPushMessageManager().handleMessage(remoteMessage)));
        } else {
            //firebase will handle this by default
        }
    }
}

yourReactNativeApp/android/app/src/main/AndroidManifest.xml

<service android:name=".NotificationService" android:exported="false">
  <intent-filter android:priority="100">
      <action android:name="com.google.firebase.MESSAGING_EVENT" />
  </intent-filter>
</service>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .