In SDK 1.17.0 there is a known bug that after trip detection is enabled the SDK may crash the Application on startup with an exception message that says "WorkManager is not initialized properly". To work around this issue implement the following:
Create WorkManagerInitializer
public class WorkManagerInitializer : Initializer<WorkManager> {
override fun create(context: Context): WorkManager {
// NOTE: If your app uses a Custom WorkManager, initialize it here.
val configuration = Configuration.Builder().build()
try {
WorkManager.initialize(context, configuration)
} catch (e: Exception){
Log.i("WorkManagerInitializer", "WorkManager initialization threw an error; likely already initialized. Error: $e")
}
return WorkManager.getInstance(context)
}
override fun dependencies(): List<Class<out Initializer<*>>> {
// No dependencies on other libraries.
return emptyList()
}
}
Create a Custom App Initializer
public class AppInitializer : Initializer<Any> {
override fun create(context: Context) {
ImsSdkInitializer().create(context)
ImsUploadManagerInitializer().create(context)
}
override fun dependencies(): MutableList<Class<out Initializer<*>>> {
return mutableListOf(WorkManagerInitializer::class.java)
}
}
Add the AppInitializer, WorkManagerInitializer, and Disable the SDK Initializers
NOTE: Do not forget to replace the packageId for the WorkManagerInitializer and AppInitializer