Location Messaging in Android Apps that Use SDK Version 10

The steps for implementing location messaging have changed in version 10 of the SDK. To upgrade your app to version 10 of the SDK, first update the initialization code. Then, use these code examples to update the location messaging code in your app.

Enable Geofence Messaging During SDK Initialization 

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

1SFMCSdk.configure(applicationContext as Application, SFMCSdkModuleConfig.build {
2  engagementModuleConfig = MarketingCloudConfig.builder().apply {
3    // Other configuration values
4    setGeofencingEnabled(true) // Enable Geofence messaging, default = false
5  }.build(applicationContext)
6}) {
7  // TODO handle initialization status
8}

Toggle Geofence Messaging at Runtime 

Use this code example to toggle geofence messaging at runtime.

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