On demand init of work manager

pull/193/head
M66B 4 years ago
parent 66c23ea20c
commit 9893383a0b

@ -374,6 +374,11 @@
android:resource="@xml/fileprovider_paths" />
</provider>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
tools:node="remove" />
<receiver
android:name=".Widget"
android:label="@string/title_widget_title_count">

@ -374,6 +374,11 @@
android:resource="@xml/fileprovider_paths" />
</provider>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
tools:node="remove" />
<receiver
android:name=".Widget"
android:label="@string/title_widget_title_count">

@ -374,6 +374,11 @@
android:resource="@xml/fileprovider_paths" />
</provider>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
tools:node="remove" />
<receiver
android:name=".Widget"
android:label="@string/title_widget_title_count">

@ -32,6 +32,7 @@ import android.os.Looper;
import android.util.Printer;
import android.webkit.CookieManager;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import java.util.Date;
@ -39,7 +40,8 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class ApplicationEx extends Application implements SharedPreferences.OnSharedPreferenceChangeListener {
public class ApplicationEx extends Application
implements androidx.work.Configuration.Provider, SharedPreferences.OnSharedPreferenceChangeListener {
private Thread.UncaughtExceptionHandler prev = null;
@Override
@ -132,6 +134,7 @@ public class ApplicationEx extends Application implements SharedPreferences.OnSh
CookieManager.getInstance().setAcceptCookie(false);
MessageHelper.setSystemProperties(this);
ContactInfo.init(this);
DisconnectBlacklist.init(this);
@ -161,6 +164,15 @@ public class ApplicationEx extends Application implements SharedPreferences.OnSh
Log.i("App created " + (end - start) + " ms");
}
@NonNull
@Override
public androidx.work.Configuration getWorkManagerConfiguration() {
// https://developer.android.com/topic/libraries/architecture/workmanager/advanced/custom-configuration
return new androidx.work.Configuration.Builder()
.setMinimumLoggingLevel(android.util.Log.INFO)
.build();
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
switch (key) {

@ -375,6 +375,11 @@
android:resource="@xml/fileprovider_paths" />
</provider>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
tools:node="remove" />
<receiver
android:name=".Widget"
android:label="@string/title_widget_title_count">

Loading…
Cancel
Save