Beacon Messaging in Android Apps that Use SDK Version 10

The implementation for beacon messaging has been updated in version 10 of the SDK. To upgrade your app to version 10 of the SDK, first update the initialization code. Then, use this code example to update the beacon messaging code in your app.

Enable Beacon Messaging During SDK Initialization 

Use this code example to enable beacon messaging during SDK initialization.

1SFMCSdk.configure(applicationContext as Application, SFMCSdkModuleConfig.build {
2  engagementModuleConfig = MarketingCloudConfig.builder().apply {
3    // Other configuration values
4    setProximityNotificationOptions(
5      ProximityNotificationCustomizationOptions.create(
6        R.mipmap.ic_notification_foreground
7      )
8    ) // required config to show foreground notification
9    setProximityEnabled(true) // Enable Beacon messaging, default = false
10  }.build(applicationContext)
11}) {
12  // TODO handle initialization status
13}

Toggle Beacon Messaging at Runtime 

Use this code example to toggle beacon messaging at runtime.

1MarketingCloudSdk.requestSdk {
2  //enable
3  it.regionMessageManager.enableProximityMessaging()
4
5  //disable
6  it.regionMessageManager.disableProximityMessaging()
7}