1

i've implemented the SF Mobile Push SDK into my app and the Messages im sending from the SFMC are showing up when the App is in Foreground and Background. When i close the app (for example swipe it away from recents) then the Push Notifications will not be shown. The Device receives them but can't show them because the SDK is not initialized in that case.

Is there a Workaround for this Use Case or am i doing a mistake? Or is the SDK until now not able to show up Notifications when the app is closed?

This is my implementation inside my FirebaseMessagingService class:

    override fun onMessageReceived(remoteMessage: RemoteMessage?) {
    Log.d(TAG, "FCM Message Id: " + remoteMessage?.messageId)
    Log.d(TAG, "FCM Notification Message: " + remoteMessage?.notification)
    Log.d(TAG, "FCM Data Message: " + remoteMessage?.data)

    if (isPushServiceActivated()) {
        if (remoteMessage != null && PushMessageManager.isMarketingCloudPush(remoteMessage)) {
            MarketingCloudSdk.requestSdk { sdk ->
                sdk.pushMessageManager.handleMessage(remoteMessage)
            }
        }
    }
}

The SDK Variable is never available when the app was closed before. The method MarketingCloudSdk.isReady() is returning false. The FirebaseMessagingService (where the Message arrives) is inside a Background Thread. That means initializing the SDK is not an option there because no Activity is involved.

2

I'll start by asking the question that I'm sure I already know the answer to. Are you calling the Marketing Cloud SDK's init method from within your Application's onCreate method? If not, then that would explain your issues with not being able to access the SDK when the app receives a push message from a "cold launch" scenario.

Additionally, if the Marketing Cloud SDK is the only push provider in your application you should remove your implementation of the FirebaseMessagingService. The SDK will handle receiving and presenting a push message in all possible scenarios, assuming you're initializing it from Application#onCreate.

More info: http://salesforce-marketingcloud.github.io/JB4A-SDK-Android/sdk-implementation/implement-sdk-google.html

  • Thanks for your answer. I called the init early in our starting process but not in the onCreate of the Application. For a short period of time i have to support both push provider thats why Firebase still exists. – Lars Mar 26 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.