1MarketingCloudSdk.init(context, config) { status ->
2 when (status.status()) {
3 InitializationStatus.Status.COMPLETED_WITH_DEGRADED_FUNCTIONALITY -> {
4 if (status.locationsError()) {
5 //Handle Google Play Services issues.
6 if (GoogleApiAvailability.getInstance().isUserResolvableError(status.playServicesStatus())) {
7 // User will likely need to update GooglePlayServices through the Play Store.
8 // Call GoogleApiAvailability.getInstance().showErrorDialogFragment(...) from Activity.
9 }
10 } else if (status.messagingPermissionError()) {
11 // User disabled location permission.
12 // Re-request permission and if granted enable desired messaging type
13 }
14 }
15 InitializationStatus.Status.SUCCESS -> Log.v("MyApp", "SDK init succeeded")
16 InitializationStatus.Status.FAILED -> Log.e(
17 "MyApp",
18 "The SDK failed to initialize. Status: $status",
19 status.unrecoverableException()
20 )
21 }
22}