android-workmanager

WorkManager's PeriodicWorkRequest is executing once and not repeating

≡放荡痞女 提交于 2019-12-14 00:50:46
问题 I am trying to make use of WorkManager however I seem to be running into an issue where PeriodicSync is only repeated on startup once and that's it. I've looked at this post Is WorkManager's PeriodicWorkRequest really repeating for anyone? but there is no answer there. I am using the latest alpha build 10 as well. If someone could help, it would be greatly appreciated. I am still new to android but need to get this to work for a project. I haven't even tried using it with the code I want but

WorkManger in Android is executing doWork() more than once

落爺英雄遲暮 提交于 2019-12-13 15:01:59
问题 I am using WorkManager to schedule some tasks but the problem is that work manager is executing those tasks { doWork() } more than once in a single call. I am using: 'android.arch.work:work-runtime:1.0.0-alpha08' I have tried using -alpha07,06,05,04. But I have same issue. Sometimes it even executes 5-6 times at once Here is the code: public class MyWorker extends Worker { @NonNull @Override public Result doWork() { Log.i("CountWorker","0"); sendNotification("Notice", "A notice was sent");

Android Work Manager: “Could not instantiate Worker”

风格不统一 提交于 2019-12-13 12:25:58
问题 I've followed the Android Developer's tutorial on using the Worker Manager structure to run my code in background but anytime I try to enqueue my worker it doesn't run and I get the following error: 2018-10-04 22:25:47.004 28669-28885/app.package.com.debug E/DefaultWorkerFactory: Could not instantiate app.package.com.MyWorker java.lang.NoSuchMethodException: <init> [] at java.lang.Class.getConstructor0(Class.java:2320) at java.lang.Class.getDeclaredConstructor(Class.java:2166) at androidx

can I always use WorkManager instead of coroutines?

心不动则不痛 提交于 2019-12-13 12:08:47
问题 I wonder why should I bother with rx or coroutines when there is brilliant solution as WorkManager. But for almost all tutorials they use coroutines so may be WorkManager has disadvantages ? 回答1: The scope of both is different. WorkManager is to schedule deferrable (for any later time) or immediately. tasks asynchronously. As documentation says The WorkManager API makes it easy to specify deferrable, asynchronous tasks and when they should run. These APIs let you create a task and hand it off

Alpha-08: Apps may not schedule more than 100 distinct jobs

旧城冷巷雨未停 提交于 2019-12-13 05:49:40
问题 I've looked around and the consensus is it's fixed on Alpha-07, but I'm seeing it in 08 on a 7.0 AND 8.0 device. I have network constraints so there is a possibility that given a long period of no network I could schedule more than 100 work items. I'm a little confused about how batching plays into this. Are we saying WorkManager can only schedule 100 items before it crashes or is there still a batching bug? Thanks Code that adds to WM: Constraints constraints = new Constraints.Builder()

PeriodicWorkRequest is not initiating by WorkManager on realtime devices except emulator

廉价感情. 提交于 2019-12-13 03:10:40
问题 I am enqueuing a PeriodicWorkRequest through WorkManager , the code mentioned below is working on device having Android OS Nougat also on emulators of Android OS versions 8.1, 9 & 10 but not on OnePlus (Android 9), Redmi 5 (Android 8.1) & Google Pixel (Android 9.1). The dependency I have incorporated is, implementation "android.arch.work:work-runtime:1.0.1" (Non Androidx) Also implementation "android.arch.work:work-runtime:2.1.0-beta02" (Androidx) Code snippet, PeriodicWorkRequest.Builder

WorkManager Java Android Dagger2 [closed]

杀马特。学长 韩版系。学妹 提交于 2019-12-12 06:39:08
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 months ago . I NEED working Workmanager in Android app with JAVA only (without Kotlin!!!). In a project, we use just dagger2.8 (without android-dagger!) and I need to inject or access to some Injected classes like DataBase. (it injected in AppComponent). Already tried: https://proandroiddev.com/dagger-2-setup

I want to schedule a worker to show a notification when the device is plugged in and connected to the internet

痞子三分冷 提交于 2019-12-11 18:33:04
问题 Alright, I think the title is pretty self-explanatory...I have to use the WorkManager api to schedule a notification that will be displayed every time the device is connected to the internet and is charging(plugged-in). I managed to create a worker and make it display the notification, but the issue here is that it only shows the notification once. After that even if I disconnect/re-connect to wifi and unplug/plug the cable, it won't show the notification. val notificationTriggerConstraint =

Application crashing with WorkManager

一个人想着一个人 提交于 2019-12-11 10:31:43
问题 So recently I'm trying to test WorkManager and I'm having a bug which I don't know how to solve it... The error that I'm having is this one : 2018-06-16 16:36:36.594 23798-23815/? E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1 Process: com.example.damiii.myjobintentservice, PID: 23798 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference at androidx.room.RoomOpenHelper.checkIdentity(RoomOpenHelper

Update UI from a Workmanager

别说谁变了你拦得住时间么 提交于 2019-12-11 04:51:47
问题 How do I update the UI from Android WorkManager. Android Workmanager can receive Boolean, Integer, Long, Float, Double, String Documentation says: public Data.Builder putAll (Map<String, Object> values) "Puts all input key-value pairs into the Builder. Valid types are: Boolean, Integer, Long, Float, Double, String, and array versions of each of those types. Invalid types throw an IllegalArgumentException." How do I pass a callback for updating the UI. How to pass POJO without DB call. Result