-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Background task doesn't run after a while[BUG] #23
Comments
The Android plugin uses JobScheduler. Jobs will be throttled based upon app usage and whether the device is plugged into power or not. You won't get events fired exactly every 15 minutes. They will be delayed. |
That's what I thought too, but I then won't get any events for days. |
If the user operates your app normally (ie opening it regularly), this shouldn’t be a problem. |
The problem there is, that the usecase has the user opening the app every couple of days and then seeing all events |
I suggest sending a server push to devices you haven’t heard from in a while. |
That's what I was afraid of, thank you anyway |
Are you simulating fetch events to make sure everything is “wired up” properly? If simulated events run, nothing else to do. See README to learn how to simulate Android fetch events with |
The events are called for a long time, but after about a day it just stops |
And are you sure you're calling |
i have two calls to BackgroundFetch.finish() one in the background method and one after the call to the background method, just to be safe |
Show me what you mean by this. |
i know the second one looks horrible, all the calls to setstate are more for testing |
Actually, forget what I said above, re ( |
Are you simulating background-fetch events with |
i havent simulated events, but background events work´for a while |
And are you opening the app daily, like a regular user would? |
No, I keep forgetting, but my usecase would have the user opening the app only every couple of days anyway |
I suggest you behave as a “regular user” and observe the behavior over a week or two. Hopefully you’re sending an http request to your server as evidence an event occurs. There’s nothing else to do. |
i log the calls in sqflite since the http request is to a server i dont own |
Your Environment
flutter info
,flutter doctor
): Doctor summary (to see all details, run flutter doctor -v):[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.706], locale de-DE)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (version 3.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] Android Studio (version 3.2)
[√] VS Code (version 1.33.1)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
To Reproduce
Steps to reproduce the behavior:
minimumFetchInterval: 15,
stopOnTerminate: false,
startOnBoot: true,
enableHeadless: true)
The text was updated successfully, but these errors were encountered: