Notification Segmentation

Deliver location messages to a subset of your audience by using the Android SDK. For example, when a mobile device enters a geofence or is close to a Bluetooth beacon, the SDK can prompt a callback to your mobile app. The app then assesses whether to display a message. For example, you can use segmentation in these use cases:

  • Show the message if the user’s preferred store location is within the geofence region.
  • Show the message if the user has items in the app shopping cart and if the message has an "abandonedCart":"true" custom key.
  • Show the message only when the store is open based on the app’s store location list and the region and local time.
  • Don’t show messages if the user isn’t logged in to the app.
  • Show specific messages based on the user’s customer profile. For example, customers who are coffee lovers get messages about coffee, but customers who prefer pastries receive a message to “buy coffee” when they’re in the shop.

Provide an implementation of ShouldShowNotificationListener to the NotificationManager. When you implement shouldShowNotification, you can access all information about the triggering message, including region data for geofence and beacon triggers.

This example shows how to target only Gold loyalty-tier customers for delivery of a message. The marketer sets the custom key loyaltyLevel to gold while creating the location message.

1SFMCSdk.requestSdk { sdk ->
2  sdk.mp {
3    it.notificationManager.setShouldShowNotificationListener { message ->
4      val messageLoyaltyLevel = message.customKeys["loyaltyLevel"]
5      val customerLoyaltyLevel = it.registrationManager.attributes["loyaltyLevel"]
6
7      messageLoyaltyLevel == "gold" && customerLoyaltyLevel == "gold"
8    }
9  }
10}
1MarketingCloudSdk.requestSdk { sdk ->
2  sdk.notificationManager.setShouldShowNotificationListener { message ->
3    val messageLoyaltyLevel = message.customKeys()["loyaltyLevel"]
4    val customerLoyaltyLevel = sdk.registrationManager.attributes["loyaltyLevel"]
5
6    messageLoyaltyLevel == "gold" && customerLoyaltyLevel == "gold"
7  }
8}