Для фона и после уничтожения Фоновая геолокация (@ mauron85 / react-native-background-geolocation) . Пожалуйста, обратитесь ниже код
BackgroundGeolocation.removeAllListeners();
BackgroundGeolocation.configure({
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stationaryRadius: 50,
distanceFilter: 50,
notificationTitle: 'Background tracking',
notificationText: 'ENABLED',
startForeground: false,
notificationsEnabled: false,
debug: false,
startOnBoot: false,
stopOnTerminate: true,
locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
interval: 1000,
fastestInterval: 10000,
activitiesInterval: 10000,
stopOnStillActivity: false,
}, res => {
BackgroundGeolocation.start();
BackgroundGeolocation.on('location', async (location) => {
BackgroundGeolocation.stop();
});
});