Rasla
Rasla

Reputation: 138

Background API Calls Stopping When Screen Is Off on Some Android Devices Despite Proper Settings

I am working on an flutter app, where we need to send the user's location (latitude and longitude) to our server every 20-30 seconds in the background. The server checks if the user is within a certain range. This works well on some devices but has inconsistent behavior on others.

The issue:

On some phones, background API calls stop when the screen is turned off. On these devices, the app only works as expected if we manually tweak multiple settings such as background restrictions, network restrictions, and battery optimizations.

Here’s a summary of my setup:

Platform: Android Background process: Running in a foreground service with a periodic WorkManager for API calls.

Any insights or solutions to ensure more consistent background behavior across different devices would be appreciated!

What I've tried:

My questions are:

Upvotes: 0

Views: 121

Answers (0)

Related Questions