android-workmanager

Android WorkManager doesn't trigger one of the two scheduled workers

半腔热情 提交于 2020-04-11 04:03:19
问题 I have two periodic workers scheduled in my app where one worker repeats after 24 hours and another in 15 minutes. Initially on fresh install things work as expected, but after some days I got an issue on 2 devices(out of 5). The 24 hour worker is triggered properly but the 15 minute one isn't triggered at all. I have been monitoring this for 24 hours now. I viewed the databse of workmanager via Stetho and saw some entries for 24-hour worker and 0 entries for 15 minute worker. I'm looking in

Flutter workmanager plugin doesn't work with any other plugin when running task

不想你离开。 提交于 2020-04-07 03:22:33
问题 After initialising the the workmanager and creating either of the tasks, If we use any plugins inside of the task execution it isn't recognised and throw an error as bellow MissingPluginException(No implementation found for method getLocation on channel lyokone/location) Actual code : Workmanager.executeTask((task, inputData) async { Location locationObject = Location(); locationObject.getLocation(); print(locationObject); return Future.value(true); } Basically any other plugin used inside of

WorkManager: exiting properly from startWork() without doing any work

寵の児 提交于 2020-03-04 15:47:12
问题 When my scheduled periodic work request runs, it may be the case that I don't want it to do any work at that time, and just wait for the next in the periodic series. At present I'm handling this by setting the Completer to a success state and returning before firing the async work stuff, like so: public ListenableFuture<Result> startWork() { return CallbackToFutureAdapter.getFuture(completer -> { if ( notThisTime() ) { completer.set(Result.success()); return "nothing to do this time"; } //

WorkManager: exiting properly from startWork() without doing any work

我是研究僧i 提交于 2020-03-04 15:45:11
问题 When my scheduled periodic work request runs, it may be the case that I don't want it to do any work at that time, and just wait for the next in the periodic series. At present I'm handling this by setting the Completer to a success state and returning before firing the async work stuff, like so: public ListenableFuture<Result> startWork() { return CallbackToFutureAdapter.getFuture(completer -> { if ( notThisTime() ) { completer.set(Result.success()); return "nothing to do this time"; } //

How to make Flutter Workmanager plugin and Location plugin work together

二次信任 提交于 2020-02-25 05:01:30
问题 The bounty expires in 2 days . Answers to this question are eligible for a +50 reputation bounty. Tom O wants to draw more attention to this question. 1. Problem description My goal is to build a Flutter app that gets periodic location updates using this workmanager plugin and using this location plugin. But I can't get the Location plugin to be loaded properly when my Workmanager callback fires. I get this error: MissingPluginException(No implementation found for method getLocation on

How to make Flutter Workmanager plugin and Location plugin work together

妖精的绣舞 提交于 2020-02-25 05:01:24
问题 The bounty expires in 2 days . Answers to this question are eligible for a +50 reputation bounty. Tom O wants to draw more attention to this question. 1. Problem description My goal is to build a Flutter app that gets periodic location updates using this workmanager plugin and using this location plugin. But I can't get the Location plugin to be loaded properly when my Workmanager callback fires. I get this error: MissingPluginException(No implementation found for method getLocation on

JobScheduler is not working in Xiaomi when app is not in background and auto-start option is disabled

筅森魡賤 提交于 2020-02-24 14:28:07
问题 I want to run a task in my app everyday, I am using JobScheduler for it and works fine in stock OS, but when I try to run it in phones which has custom ROM (Xiaomi) it doesn't work unless I explicitly enable auto-start option for the app in security. Is there any solution for this, how are other apps handling this scenario ? 回答1: This is a known issue with some Android OEM that heavily modify this part of Android for battery optimization. Aside having you application added to the whitelist,

IllegalStateException: WorkManager is already initialized

﹥>﹥吖頭↗ 提交于 2020-02-24 04:32:21
问题 Having these dependencies: dependencies { implementation "androidx.work:work-runtime:2.0.1" androidTestImplementation "androidx.work:work-testing:2.0.1" } When running this code for the second time: Configuration config = new Configuration.Builder().build(); WorkManager.initialize(getApplicationContext(), config); this.workManager = WorkManager.getInstance(); I get this error message: java.lang.IllegalStateException: WorkManager is already initialized. Did you try to initialize it manually

IllegalStateException: WorkManager is already initialized

人走茶凉 提交于 2020-02-24 04:31:37
问题 Having these dependencies: dependencies { implementation "androidx.work:work-runtime:2.0.1" androidTestImplementation "androidx.work:work-testing:2.0.1" } When running this code for the second time: Configuration config = new Configuration.Builder().build(); WorkManager.initialize(getApplicationContext(), config); this.workManager = WorkManager.getInstance(); I get this error message: java.lang.IllegalStateException: WorkManager is already initialized. Did you try to initialize it manually

WorkManager: Why does failed unique work with the “APPEND” ExistingWork strategy not allow more work under the same name?

孤街醉人 提交于 2020-02-23 09:56:44
问题 Let's say we are developing a messaging app where we want to send messages into given conversations where the order of those messages is important in that conversation only, and if the app is put to the background, we want a guarantee that the message will be sent. The WorkManager#beginUniqueWork method seems ideal for this, where the uniqueWorkName will be some conversation id, and ExistingWorkPolicy.APPEND will be used as the work policy to keep the work in the order scheduled. So far in my