android-workmanager

WorkManager OneTimeWorkRequest InitialDelay works after twise the time set

微笑、不失礼 提交于 2020-01-11 07:19:14
问题 UPDATE (21-nov-2019) WorkManager.getInstance(activity).enqueueUniquePeriodicWork("test_work", ExistingPeriodicWorkPolicy.KEEP, PeriodicWorkRequest.Builder(MyWorker::class.java, 15, TimeUnit.MINUTES) .build()) Now I'm using PeriodicWork and now doWork() called twice even I cancelled uniquettask at first attempt.I'm getting Notification twice and Checked in Log also It's called twice . Note: It's happen only first time and sometime second time also but not getting third time twice. override fun

How to implement Dagger for worker classes?

女生的网名这么多〃 提交于 2020-01-10 03:34:04
问题 Since the Worker class is created by the framework ( WorkerManager ), how can we use @Inject fields into the Worker ? 回答1: You have to provide class using @Provides annotation in the module to inject. First create a component containing a module which will provide the class. @Component(modules = {Module.class}) public interface Component1{ void inject(SyncWorker syncWorker); } Module Class @Module public class Module{ @Provides public ISettingRepository getSettingRepo(){ return new

More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro'

巧了我就是萌 提交于 2019-12-31 08:33:18
问题 i am trying android WorkManager, The code is throwing error " More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro " when running, I tried the following answer, it was not helpful. WorkManager Dependencies build.gradle(app) apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "rock.dmx.xaro.workmanagerexample" minSdkVersion 19 targetSdkVersion 28 versionCode 1 versionName "1.0"

More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro'

流过昼夜 提交于 2019-12-31 08:32:49
问题 i am trying android WorkManager, The code is throwing error " More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro " when running, I tried the following answer, it was not helpful. WorkManager Dependencies build.gradle(app) apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "rock.dmx.xaro.workmanagerexample" minSdkVersion 19 targetSdkVersion 28 versionCode 1 versionName "1.0"

Unable to initiate WorkManager from a separate process

落爺英雄遲暮 提交于 2019-12-24 11:21:55
问题 I'm using the WorkManager library(version: 1.0.0-alpha12). In my app I'm creating a new process using the below xml line in AndroidManifest. android:process=":myprocess" This is how I use the WorkManager: public static void startCheckStatusWorker() { WorkManager manager = WorkManager.getInstance(); String uniqueName = "check_status_worker"; PeriodicWorkRequest.Builder builder = new PeriodicWorkRequest.Builder(CheckStatusWorker.class, 1, TimeUnit.DAYS); builder.setConstraints(new Constraints

Android WorkManager 10 minute thread timeout coming from somewhere

梦想的初衷 提交于 2019-12-23 18:36:56
问题 I'm using android.arch.work:work-runtime:1.0.0-alpha12 to run one and only one long-running task. The process can take as much as 20 minutes on an old (slow) device. This is the code snippet used to start the task: OneTimeWorkRequest databaseWork = new OneTimeWorkRequest.Builder(DatabaseWorker.class) .build(); WorkManager.getInstance().enqueue(databaseWork); For background info, databaseWork is retrieving an encrypted zip file, decrypting it, then using the contents to restore a bunch of

room crashes while accessing it store data

扶醉桌前 提交于 2019-12-23 13:24:15
问题 I using work manager to save data to my local database and then put the same data to the server. In localDeleteRequest class, I am passing id as WorkData and using that id to get the object which is being stored in the local database Work Manager function: private fun deleteUserWork(userEntity: UserEntity) { val workManager: WorkManager = WorkManager.getInstance() val constraint = Constraints.Builder() .setRequiredNetworkType(NetworkType.CONNECTED) .build() val inputData: Data = mapOf("id" to

Is WorkManager's PeriodicWorkRequest really repeating for anyone?

拟墨画扇 提交于 2019-12-23 12:27:37
问题 I have tried making a repeated task every 15 minutes but Worker#doWork NEVER gets called, not even the very first time (on Nexus 6P - Android 8). However, when testing on an Android 8 emulator, I observed that it gets called the first time pretty soon after the work is scheduled, however it never repeats again. What did I do wrong? build.gradle: implementation "android.arch.work:work-runtime-ktx:1.0.0-alpha07" kotlin code: val work = PeriodicWorkRequestBuilder<WidgetUpdateWorker>(MIN_PERIODIC

PeriodicWorkRequest not working after device reboot in android oreo

那年仲夏 提交于 2019-12-23 09:58:25
问题 I have requirement of pushing in app notification to user based on following logic. Type A notification will be shown after every 24 hours. Type B notification will be shown after every 7 days. Type C notification will be shown after every 15 days. I have used PeriodicWorkRequest work manager as follows, its working fine until device is restart. Once device is restart my work is not getting trigger. build.gradle --- implementation 'android.arch.work:work-runtime:1.0.0-alpha04' Java code

Check if WorkRequest has been previously enquequed by WorkManager Android

笑着哭i 提交于 2019-12-22 03:43:55
问题 I am using PeriodicWorkRequest to perform a task for me every 15 minutes. I would like to check, if this periodic work request has been previously scheduled. If not, schedule it. if (!PreviouslyScheduled) { PeriodicWorkRequest dataupdate = new PeriodicWorkRequest.Builder( DataUpdateWorker.class , 15 , TimeUnit.MINUTES).build(); WorkManager.getInstance().enqueue(dataupdate); } Previously when I was performing task using JobScheduler, I used to use public static boolean isJobServiceScheduled