Closed ifgabriel closed 6 months ago
delay: .20,
Read the api docs. delay
requires an integer and is measured in milliseconds
@christocracy Even using 20000 in the delay, the task is executed every 1 minute, is this happening because the minimumFetchInterval is in minutes? it doesn't accept 0.20 correct? Do you know how I solve my problem?
minimumFetchInterval is minutes
.
You know that .scheduleTask is optional, right?
Simply calling .configure initiates a default periodic task of minimumFetchInterval minutes.
Ok, but would I be able to do a periodic task of less than 1 minute?
No.
Is this an android or lib block?
Android does not allow periodic AlarmManager
tasks to run any less than every minute.
Attempting to fetch location every 20s using a periodic task is considered abusive to the user's device battery.
Ok. Thank you for your time and explanations!
Your Environment:
Code
Expected Behavior
Should update coordinate every 20 seconds
Actual Behavior
It is updating the coordinates every 1 second
Steps to Reproduce
Context
I'm trying to update device coordinates even with the app running in the background
Debug logs
[Tue Oct 31 2023 11:18:50.901] LOG [BackgroundFetch] configure status: 2 [Tue Oct 31 2023 11:19:24.217] LOG [BackgroundFetch] task: UPDATE_COORDINATES [Tue Oct 31 2023 11:20:42.110] LOG [BackgroundFetch] task: UPDATE_COORDINATES [Tue Oct 31 2023 11:21:42.760] LOG [BackgroundFetch] task: UPDATE_COORDINATES [Tue Oct 31 2023 11:22:42.760] LOG [BackgroundFetch] task: react-native-background-fetch [Tue Oct 31 2023 11:22:42.137] LOG [BackgroundFetch] task: UPDATE_COORDINATES [Tue Oct 31 2023 11:23:42.760] LOG [BackgroundFetch] task: UPDATE_COORDINATES [Tue Oct 31 2023 11:24:42.740] LOG [BackgroundFetch] task: UPDATE_COORDINATES