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.