I am using multiple push sdks in my project. I have SF Auth SDK as well. I have configured SFMC properly and I can receive the notifications as well as the inbox messages, but when I interact with the push notification from notification tray I don't see the app opening rather a transparent background window opens and all I can see if the title "Notification Message"
my code
SFMCSdk.configure( applicationContext as Application, SFMCSdkModuleConfig.build { pushModuleConfig = MarketingCloudConfig.builder().apply { setApplicationId(BuildConfig.SALESFORCE_MC_APP_ID) setAccessToken("########") setMarketingCloudServerUrl(BuildConfig.SALESFORCE_MC_SERVER_URL) setMid(BuildConfig.SALESFORCE_MC_MID) setNotificationCustomizationOptions( NotificationCustomizationOptions.create(R.drawable.ic_stat_app_logo_transparent) ) setMarkMessageReadOnInboxNotificationOpen(true) setDelayRegistrationUntilContactKeyIsSet(true) setInboxEnabled(true) // Enable Inbox messaging }.build(applicationContext) } ) { initStatus -> when (initStatus.status) { com.salesforce.marketingcloud.sfmcsdk.InitializationStatus.SUCCESS -> { logVerbose("SFMC STATUS", "Marketing Cloud init was successful") SFMCSdk.requestSdk { sdk -> sdk.mp { try { FirebaseMessaging.getInstance().token.addOnCompleteListener { task -> if (task.isSuccessful) { SFMCSdk.requestSdk { sdk -> sdk.mp { logDebug( "FIREBASE_MESSAGING", "SUCCESS: task result: ${task.result}" ) it.pushMessageManager.setPushToken(task.result) } } } } } catch (e: ExceptionInInitializerError) { logError( "FIREBASE_MESSAGING", "FAILURE: Exception in initializer. ${e.message}" ) } } } } com.salesforce.marketingcloud.sfmcsdk.InitializationStatus.FAILURE -> { logError("SFMC STATUS", "Marketing Cloud failed to initialize.") } } I have tried other options as well, for example handling the channel, composition and pendingIntent through app as well but same behaviour
fun createNotificationChannel(context: Context) { val channelId = "default_channel_id" val channelName = "Default Channel" val channelDescription = "This is the default notification channel" val importance = android.app.NotificationManager.IMPORTANCE_DEFAULT val channel = NotificationChannel(channelId, channelName, importance).apply { description = channelDescription } val notificationManager: android.app.NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as android.app.NotificationManager notificationManager.createNotificationChannel(channel) } ... SFMCSdk.configure( applicationContext as Application, SFMCSdkModuleConfig.build { pushModuleConfig = MarketingCloudConfig.builder().apply { setApplicationId(BuildConfig.SALESFORCE_MC_APP_ID) setAccessToken(it) setMarketingCloudServerUrl(BuildConfig.SALESFORCE_MC_SERVER_URL) setMid(BuildConfig.SALESFORCE_MC_MID) setMarkMessageReadOnInboxNotificationOpen(true) setDelayRegistrationUntilContactKeyIsSet(true) setInboxEnabled(true) // Enable Inbox messaging setUrlHandler(this@ABCApplication) setNotificationCustomizationOptions( NotificationCustomizationOptions.create { context, notificationMessage -> // Ensure the notification channel is created createNotificationChannel(context) val builder = NotificationCompat.Builder(context, "default_channel_id") builder.setContentTitle(notificationMessage.title) builder.setSmallIcon(R.drawable.ic_stat_app_logo_transparent) builder.setContentText(notificationMessage.alert) builder.setPriority(NotificationCompat.PRIORITY_DEFAULT) builder.setAutoCancel(true) builder.setContentIntent( NotificationManager.redirectIntentForAnalytics( context, PendingIntent.getActivity( context, Random().nextInt(), Intent(context, MainActivity::class.java), PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE ), notificationMessage, true ) ) val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as android.app.NotificationManager notificationManager.notify(Random().nextInt(), builder.build()) Log.d( "Notification", "Notification built and displayed successfully." ) builder } ) }.build(applicationContext) } ) { initStatus -> when (initStatus.status) { com.salesforce.marketingcloud.sfmcsdk.InitializationStatus.SUCCESS -> { logVerbose("SFMC STATUS", "Marketing Cloud init was successful") SFMCSdk.requestSdk { sdk -> sdk.mp { try { FirebaseMessaging.getInstance().token.addOnCompleteListener { task -> if (task.isSuccessful) { SFMCSdk.requestSdk { sdk -> sdk.mp { logDebug( "FIREBASE_MESSAGING", "SUCCESS: task result: ${task.result}" ) it.pushMessageManager.setPushToken(task.result) } } } } } catch (e: ExceptionInInitializerError) { logError( "FIREBASE_MESSAGING", "FAILURE: Exception in initializer. ${e.message}" ) } } } } com.salesforce.marketingcloud.sfmcsdk.InitializationStatus.FAILURE -> { logError("SFMC STATUS", "Marketing Cloud failed to initialize.") } } } and
override fun handleUrl(context: Context, p1: String, p2: String): PendingIntent? { val intent = Intent(context, MainActivity::class.java).apply { action = Intent.ACTION_VIEW data = Uri.parse(p1) flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK } return PendingIntent.getActivity( context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE ) } Any help would be greatly appreciated. Thanks.
BUTyou're callingnotifyin your own code AND handing the builder back to the SDK. You have an implementation problem in this code.