Migrate Android Apps to Version 10 of the SDK

The process for migrating your Android apps to version 10 of the SDK depends on which features you use. To start the process of migrating your apps, use this code example to update the initialization code in your app to use version 10 of the SDK.

1class MyApplication: Application() {
2	override fun onCreate() {
3		super.onCreate()
4
5		// Initialize logging _before_ initializing the SDK to avoid losing valuable debugging information.
6		if (BuildConfig.DEBUG) {
7			SFMCSdk.setLogging(LogLevel.DEBUG, LogListener.AndroidLogger())
8			MarketingCloudSdk.setLogLevel(MCLogListener.VERBOSE)
9			MarketingCloudSdk.setLogListener(MCLogListener.AndroidLogListener())
10		}
11
12		SFMCSdk.configure(applicationContext as Application, SFMCSdkModuleConfig.build {
13			engagementModuleConfig = MarketingCloudConfig.builder().apply {
14				setApplicationId("{mc_application_id}")
15				setAccessToken("{mc_access_token}")
16				setMarketingCloudServerUrl("{marketing_cloud_url}")
17				// Other configuration options
18			}.build(applicationContext)
19		}) {
20			initStatus - >
21				// TODO handle initialization status
22		}
23	}
24}

Next, update the code in your app for any of the SDK functions that you use.