I'm developing a GPS tracking app by using location. I've wrapped the intervals function to send latitude and longitude in API. It works on an emulator when the screen is locked and stay on home screen
void _startInterval() {
timerInterval = Timer.periodic(const Duration(seconds: 5), (timer) {
_sendLocation(); // Send location to api
});
}
So when I'm building the APK to my device my application cannot send the location. Is there any way to send the location the same as the Emulator?