Troubleshoot Initialization Errors
The InitializationStatus is provided via the InitializationListener passed into the call to the MarketingCloudSdk’s init method. There is a lot of information provided in this class that are useful for debugging issues with the SDK’s initialization, but only a few things can be addressed and runtime.
Below We’ll detail the methods from InitializationStatus that are useful to check at runtime and how you might be able to recover from them.
If all you want to know is whether or not the SDK is un a “usable” state then you can use this method. The term “usable” here simply means that the SDK’s initialization did not fail. However, there might be other issues you would want to address.
This method will return the Status of the initialization call.
If you have configured the SDK to enable either geofence or proximity messaging this method will indicate whether the SDK encountered an issue with the Google Play Service location library. In additional to this method you can also use playServicesMessage() and playServicesStatus() to determine the exact action that you will need to take to resolve this issue; however, the most likely issue is that the device does not have a version of Google Play Services installed that is compatible and you should prompt the user to perform an update.
Enabling geofence or proximity messaging requires you to request the runtime permission for location. Once you have do this, and called the corresponding messaging enablement method (enableGeofenceMessaging / enableProximityMessaging) the SDK will keep track of this and verify that the permission is still granted during each subsequent initialization. If, the user has revoked the location permission from your application then the SDK will disable the previously enabled messaging type and required you to re-request the permission from the user, and re-enable the messaging in the SDK.