fluttercommunity / flutter_workmanager

A Flutter plugin which allows you to execute code in the background on Android and iOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐞[Background Processing Task not working on iOS]

sinhpn92 opened this issue Β· comments

commented

Hello,

I have integrated according to the instructions for iOS. I have also tried with the example project, but it doesn't work with registerProcessingTask. When I tried with registerOneOffTask, it worked, but registerProcessingTask did not. Has anyone encountered this issue on iOS?

I check the console log of device and receive the cancellation log:

15:09:38.380551+0700	Runner	submitTaskRequest: <BGProcessingTaskRequest: be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask, earliestBeginDate: 2024-05-20 08:09:41 +0000, requiresExternalPower=0, requiresNetworkConnectivity=0>
15:09:38.380904+0700	Runner	Submitting task request activity: bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:200A93
15:09:38.388829+0700	dasd	Daemon Canceling Activities: {(
    bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:751E8D
)}
15:09:38.389446+0700	dasd	CANCELED: bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:751E8D at priority 10 <private>!
15:09:38.393362+0700	dasd	Submitted Activity: bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:200A93 at priority 10 (Mon May 20 15:17:08 2024 - Mon May 27 15:17:08 2024)
15:17:08.728142+0700	dasd	bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:200A93:[
	{name: DeviceActivityPolicy, policyWeight: 5.000, response: {Decision: Can Proceed, Score: 0.05}}
 ] sumScores:25.880000, denominator:30.630000, FinalDecision: Can Proceed FinalScore: 0.844923}
15:17:08.728425+0700	dasd	'bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:200A93' CurrentScore: 0.844923, ThresholdScore: 0.851473 DecisionToRun:0

My versions:

  workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      ref: b783000

Doctor:

[βœ“] Flutter (Channel stable, 3.19.5, on macOS 14.3.1 23D60 darwin-arm64, locale en-US)
    β€’ Flutter version 3.19.5 on channel stable at /Data/flutter_sdk
    β€’ Upstream repository https://github.com/flutter/flutter.git
    β€’ Framework revision 300451adae (8 weeks ago), 2024-03-27 21:54:07 -0500
    β€’ Engine revision e76c956498
    β€’ Dart version 3.3.3
    β€’ DevTools version 2.31.1
    
[βœ“] Xcode - develop for iOS and macOS (Xcode 15.2)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Build 15C500b
    β€’ CocoaPods version 1.15.0

Looking at the documentation it seems that they might indicate ios works only with the one off task as this is the only sentence above the ios example
"iOS supports One off tasks with a few basic constraints:"

commented

Looking at the documentation it seems that they might indicate ios works only with the one off task as this is the only sentence above the ios example "iOS supports One off tasks with a few basic constraints:"

I saw registerProcessingTask in their example code, so I tried it. However, I did not see any trigger for this task. I looked up some documents about iOS Background Processing tasks. They say that the operating system decides when the task will be executed, and we cannot know when it will run; it depends on the operating system. It could be a few minutes later, a few hours later, or even a few days later. This is a real obstacle for data synchronization in the application. Is this true? Can anyone help me understand this better?

Looking at the documentation it seems that they might indicate ios works only with the one off task as this is the only sentence above the ios example "iOS supports One off tasks with a few basic constraints:"

I saw registerProcessingTask in their example code, so I tried it. However, I did not see any trigger for this task. I looked up some documents about iOS Background Processing tasks. They say that the operating system decides when the task will be executed, and we cannot know when it will run; it depends on the operating system. It could be a few minutes later, a few hours later, or even a few days later. This is a real obstacle for data synchronization in the application. Is this true? Can anyone help me understand this better?

Do you have any updates?