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 ?