android-workmanager

Unable to import java.time.Duration in PeriodicWorkRequest class (WorkManager)

回眸只為那壹抹淺笑 提交于 2021-01-29 05:58:38
问题 Getting Cannot resolve symbol for import java.time.Duration in PeriodicWorkRequest class. Java: 8 JDK: 1.8.0_191 implementation 'android.arch.work:work-runtime:1.0.0-alpha10' 回答1: Make sure that compileSdkVersion is set to 26 or higher because java.time.Duration is available only on API 26+. This won't affect the ability to run your app on devices with a lower API level. 来源: https://stackoverflow.com/questions/52996714/unable-to-import-java-time-duration-in-periodicworkrequest-class

Location not getting called from WorkManager

笑着哭i 提交于 2021-01-29 05:39:13
问题 I am using work manager to start location services, it loads doWork() method after every 15 minutes , but does not execute onLocationChanged . Before i was using Job Scheduler, and it was working just fine. The following code also works fine, if i display notification from Work Manager after 15 minutes. This is my code. public class LocationWorker extends Worker implements LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{ private static final

React Native HeadlessJs task call with android WorkManager

拟墨画扇 提交于 2021-01-28 18:27:55
问题 I'm creating a React Native background sync task with Android WorkManager. The doWork method in WorkManager class is called periodically, correctly. The problem I'm facing is how to call the react native function from the doWork method. In my current implementation the JavaScript function is not called. Headless Task in React Native // index.js AppRegistry.registerHeadlessTask('SyncHeadlessTask', () => SyncHeadlessTask); // SyncHeadlessTask.js module.exports = async (taskData) => { console

Can not inject workmanager constructor with Hilt

我是研究僧i 提交于 2021-01-28 05:48:14
问题 I'm developing an Android app. and I'm trying to use hilt with workmanager constructor but it does not work and gives me this error : 2020-08-18 19:01:09.989 18125-18759/com. E/WM-WorkerFactory: Could not instantiate example.android.app.database.DeleteNotesWorker java.lang.NoSuchMethodException: example.android.app.database.DeleteNotesWorker.<init> [class android.content.Context, class androidx.work.WorkerParameters] at java.lang.Class.getConstructor0(Class.java:2328) at java.lang.Class

When to use JobIntentService vs WorkManager?

青春壹個敷衍的年華 提交于 2021-01-27 02:36:51
问题 Google recently deprecated IntentService as of: https://android.googlesource.com/platform/frameworks/base.git/+/6f8b09029932dfd24945202017639754b00acc2e The docs for IntentService now say: * @deprecated IntentService is subject to all the * <a href="/preview/features/background.html">background execution limits</a> * imposed with Android 8.0 (API level 26). Consider using {@link androidx.work.WorkManager} * or {@link androidx.core.app.JobIntentService}, which uses jobs * instead of services

WorkManager : How to set-up different WorkManager Configurations in same App

萝らか妹 提交于 2021-01-04 05:43:09
问题 I'm working on a multi module project (Gradle module). I'm using WorkManager in my module. I'm also making use of Dagger for dependency injection. Now I have to use dagger to inject dependencies to my WorkManager. I'm quite familiar with Dagger 2 setup with WorkManager. But the problem I'm facing is, I have to use worker factory to make it compatible with dagger. So that I can inject dependencies with the help of Dagger Multi bindings. But currently the WorkManager configuration in the main

WorkManager : How to set-up different WorkManager Configurations in same App

巧了我就是萌 提交于 2021-01-04 05:42:53
问题 I'm working on a multi module project (Gradle module). I'm using WorkManager in my module. I'm also making use of Dagger for dependency injection. Now I have to use dagger to inject dependencies to my WorkManager. I'm quite familiar with Dagger 2 setup with WorkManager. But the problem I'm facing is, I have to use worker factory to make it compatible with dagger. So that I can inject dependencies with the help of Dagger Multi bindings. But currently the WorkManager configuration in the main

WorkManager : How to set-up different WorkManager Configurations in same App

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-04 05:42:05
问题 I'm working on a multi module project (Gradle module). I'm using WorkManager in my module. I'm also making use of Dagger for dependency injection. Now I have to use dagger to inject dependencies to my WorkManager. I'm quite familiar with Dagger 2 setup with WorkManager. But the problem I'm facing is, I have to use worker factory to make it compatible with dagger. So that I can inject dependencies with the help of Dagger Multi bindings. But currently the WorkManager configuration in the main

androidx.work.impl.WorkManagerInitializer: java.lang.ClassNotFoundException: “androidx.work.impl.WorkManagerInitializer” on path: /data/app/app-2.apk

99封情书 提交于 2021-01-02 08:05:47
问题 I recently migrated my old app's background services to WorkManager. On recent devices (down to sdk 22 included ) it looks OK, running repeating work units and scheduling them even across device reboots as expected. The problem is when I test against old version (old is very relative here), Android sdk 14 which is my minSdkVersion . BTW also WorkManager should have the same: Backwards compatible up to API 14 according to doc. As stated in title, error I get is : java.lang.RuntimeException:

androidx.work.impl.WorkManagerInitializer: java.lang.ClassNotFoundException: “androidx.work.impl.WorkManagerInitializer” on path: /data/app/app-2.apk

风流意气都作罢 提交于 2021-01-02 08:05:31
问题 I recently migrated my old app's background services to WorkManager. On recent devices (down to sdk 22 included ) it looks OK, running repeating work units and scheduling them even across device reboots as expected. The problem is when I test against old version (old is very relative here), Android sdk 14 which is my minSdkVersion . BTW also WorkManager should have the same: Backwards compatible up to API 14 according to doc. As stated in title, error I get is : java.lang.RuntimeException: