How to keep background geolocation running after device reboot [React native]

Please provide the following:

  1. SDK Version: 39
  2. Platforms(Android/iOS/web/all): All

I’m currently trying to make an app which fetch the geolocation of the user. I want my geolocation to work when the app is in foreground, when it is killed and after a device reboot.

Currently my geolocation work in the foreground and when the app is killed but i don’t know how to keep my task alive after a device reboot.

I’m using the expo-location librarie to fetch the geolocation and the expo task manager to keep the fetching alive when the app is killed

I heard about react-native-queue but i don’t understand what it add to the task-manager

i’m using http post request to debug when my device is not connected to the react-native server (after a reboot)

Did someone already faced this issue?

Issue : How to keep background geolocation running after device reboot

Here is my code:

import React from 'react';
import { StyleSheet, Button, View, SafeAreaView, Text, Alert } from 'react-native';
import FlexTest from './Components/FlexTest'
import * as Location from 'expo-location'
import * as TaskManager from 'expo-task-manager'


const firstTask = 'background-location-task';

export default class App extends React.Component {


  async onPress (){
    const { status } = await Location.requestPermissionsAsync();
    if (status === 'granted') {
       Location.startLocationUpdatesAsync(firstTask, {
        accuracy: Location.Accuracy.Balanced,
      });
    }
    else{
      console.log("oups");
    }

  }
    

  render(){
    return (
      <View>
        <Button title ="PressMe" onPress = {this.onPress}/>
      </View>
      
    )
  }
 
}

TaskManager.defineTask(firstTask, ({ data, error }) => {
  if (error) {
    console.log(error.message);
    return;
  }
  if (data) {
    const { locations } = data;

    fetch('https://ptsv2.com/t/yoyoy/post', {
      method: 'POST',
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        loc: locations
      })
    });
    console.log("locations", locations);
    }
});

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});