0

I'm integrating Salesforce mobile push in react-native application using the official library

https://github.com/salesforce-marketingcloud/react-native-marketingcloudsdk

I used firebase cloud messaging to display the message as alert like this

  useEffect(() => {
    const unsubscribe = messaging().onMessage(async (remoteMessage) => {
      Alert.alert('A new FCM message arrived!', JSON.stringify(remoteMessage));
    });

    return unsubscribe;
  }, []);

But even without that, message arrives for iOS as a system push notification message. But for Android the message is not displaying when we're not in the app. And when we're in the app it receives and showing in this Alert. But what I need to get displayed in the system notification.

I've added <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> in the app AndroidManifest and below code in MainApplication.java

  SFMCSdk.configure((Context) this, SFMCSdkModuleConfig.build(builder -> {
        builder.setPushModuleConfig(MarketingCloudConfig.builder()
                .setApplicationId(BuildConfig.MC_APP_ID)
                .setAccessToken(BuildConfig.MC_ACCESS_TOKEN)
                .setSenderId(BuildConfig.MIC_SENDER_ID)
                .setMarketingCloudServerUrl(BuildConfig.MC_APP_SERVER_URL)
                .setNotificationCustomizationOptions(NotificationCustomizationOptions.create(R.drawable.ic_notification))
                .setDelayRegistrationUntilContactKeyIsSet(true)
                .setAnalyticsEnabled(true)
                .build(this));

        return null;
    }), initializationStatus -> {
        return null;
    });

How can I get that fixed ? What I might be missing ?

1 Answer 1

1

The most common mistake is that you've included the RN plugin for push notifications and you don't need it, however, if you are using both Marketing Cloud and Firebase (or another push provider), please see https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/trouble-shooting/multiple-push-sdks.html

You're not seeing the message because your own, or another, service is handling the message.

1
  • 1
    Thank you very much for the response. This is the reason and removing firebase messaging fixed this. I couldn't figure out the implementation on handling receiving push messages. I just removed this and it worked. I actually don't use another push provider, only marketing cloud Sep 6 at 16:06

You must log in to answer this question.

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