CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2025-07-27
by karanatwal.github.io

Original Post

Original - Posted on 2021-04-19
by Ace



            
Present in both answers; Present only in the new answer; Present only in the old answer;

We should use -
```xml <provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" android:exported="false" tools:node="merge"> <!-- If you are using androidx.startup to initialize other components --> <meta-data android:name="androidx.work.WorkManagerInitializer" android:value="androidx.startup" tools:node="remove" /> </provider> ```
Why? because this will not disturb other initializers (MapBox in my case). And also it is recommended as given here - https://developer.android.com/develop/background-work/background-tasks/persistent/configuration/custom-configuration#remove-default
For people using Hilt with `androidx.work-*` version `2.6.0-alpha01` or later:
From [release notes][1], this version started using the new `androidx.startup` jetpack library internally. So, the way to remove `WorkManager`'s default initializer from `AndroidManifest.xml` has changed a bit.
If you are using `androidx.startup` elsewhere in your app, replace the [old change][2] with:
``` lang-xml <provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" android:exported="false" tools:node="merge"> <!-- If you are using androidx.startup to initialize other components --> <meta-data android:name="androidx.work.impl.WorkManagerInitializer" android:value="androidx.startup" tools:node="remove" /> </provider> ```
Otherwise, you can completely disable `androidx.startup` by replacing the old change with:
``` lang-xml <!-- If you want to disable androidx.startup completely. --> <provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" tools:node="remove"> </provider> ```
This way, your `HiltWorker` will use the factory in your sub-classed App again. Unfortunately, you will lose the (noticeable) benefit of delayed startup.
[1]: https://developer.android.com/jetpack/androidx/releases/work#2.6.0-alpha01 [2]: https://developer.android.com/topic/libraries/architecture/workmanager/advanced/custom-configuration#remove-default

        
Present in both answers; Present only in the new answer; Present only in the old answer;