Full Control Push Notification Customization for Android

When providing a builder to the NotificationCustomizationOptions class, you’re responsible for managing all aspects of the notification’s display properties and tap actions, including Notification Channel creation, Launch Intent action, and so on.

You can access the NotificationCompat.Builder that would have been used by the SDK and use it as a baseline for modifications. Additionally, the SDK can create a default NotificationChannel for your application.

1SFMCSdk.configure(applicationContext as Application, SFMCSdkModuleConfig.build {
2  pushFeatureModuleConfig = PushFeatureConfig.builder().apply {
3    // Other configuration values
4    setNotificationCustomizationOptions(
5      NotificationCustomizationOptions.create { context, notificationMessage ->
6        val builder = NotificationManager.getDefaultNotificationBuilder(
7          context,
8          notificationMessage,
9          NotificationManager.createDefaultNotificationChannel(context),
10          R.drawable.ic_notification_icon
11        )
12        builder.setContentIntent(
13          NotificationManager.redirectIntentForAnalytics(
14            context,
15            PendingIntent.getActivity(
16              context,
17              Random().nextInt(),
18              Intent(context, MainActivity::class.java),
19              PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
20            ),
21            notificationMessage,
22            true
23          )
24        )
25      }
26    )
27  }.build()
28}) {
29  // Handle initialization status
30}