Headless not working Android when app Inactive
See original GitHub issueYour Environment
- Plugin version: 2.4.4
- Platform: Android
- OS version: 8
- Device manufacturer / model: One Plus 5
- React Native version (
react-native -v
): 57 - Plugin config
{
minimumFetchInterval: 15, // <-- minutes (15 is minimum allowed)
stopOnTerminate: false, // <-- Android-only,
startOnBoot: true, // <-- Android-only
enableHeadless: true // <-- Android-only
}
Expected Behavior
When the app goes into inactive mode, none of the headless tasks run. We force bg-tasks by running
adb shell cmd jobscheduler run -f <app-id> 999
An app on android becomes inactive after some time. It can also be forced by running:
adb shell am set-inactive <app-id> true
Actual Behavior
The background tasks don’t run. When running adb shell am set-inactive <app-id> false
the last task fires.
Steps to Reproduce
See above.
Context
I want to keep running bg-tasks even when android throws the app into inactivity.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Restrictions on starting activities from the background
Android 10 (API level 29) and higher place restrictions on when apps can start activities when the app is running in the background....
Read more >Android. Is WorkManager running when app is closed?
I tested this using OneTimeWorkRequest. However, if the app is running and the worker is not running but is scheduled to run in...
Read more >React Native, Push Notification & Headaches
Well, it's not true for react native apps and let met tell you why ... To solve this problem, we can turn to...
Read more >Set up an open, closed, or internal test - Play Console Help
Testing your app allows you to fix any technical or user experience issues with minimal user impact, so you can release the best...
Read more >How to set up a Headless Chrome Node.js server in Docker
This makes it a stable and efficient way to not only keep running browsers idle, but keep them alive. Puppeteer connection over WebSocket...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
From the same android documentation of Doze mode:
This doesn’t seem to work for Background-Fetch. Once the phone enters doze mode once, the app background fetch never resumes to its intended schedule, even if the phone is plugged in or the screen is turned on. The app needs to be explicitly opened for the background-fetch schedule to resume.
Can we reopen this ticket?
You can think of the orange bars in the image as background-fetch events. The longer the device sits idle and unplugged from power, the less frequent that fetch events will fire. You might only get 1 per hour after long periods sitting idle.