That’s the sequence of events that happened while I was debugging the app in Android 7 emulator.
TaskService: Registered task with name ‘background-location-task’ for app with ID ‘com.appchegou’.
TaskService: Handling intent with task name ‘background-location-task’ and appId ‘com.appchegou’.
ActivityManager: Start proc 6325:com.appchegou/u0a85 for broadcast com.appchegou/expo.modules.taskManager.TaskBroadcastReceiver
BroadcastQueue: Unable to launch app com.appchegou/10085 for broadcast Intent { act=expo.modules.taskManager.TaskBroadcastReceiver dat=?appId=com.appchegou&taskName=background-location-task flg=0x10 cmp=com.appchegou/expo.modules.taskManager.TaskBroadcastReceiver (has extras) }: process is bad
What does that mean?
import React, { useEffect, useState } from 'react';
import {
Accuracy,
requestPermissionsAsync,
watchPositionAsync
} from 'expo-location';
export default (shouldTrack, callback) => {
const [err, setErr] = useState(null);
useEffect(() => {
let subscriber;
const startWatching = async () => {
try {
await requestPermissionsAsync();
subscriber = await watchPositionAsync(
{
accuracy: Accuracy.BestForNavigation,
timeInterval: 60 * 1000, //a cada minuto
distanceInterval: 0
},
callback
);
} catch (e) {
console.error(e);
setErr(e);
}
};
if (shouldTrack) {
startWatching();
} else {
if (subscriber) {
subscriber.remove();
}
subscriber = null;
}
return () => {
if (subscriber) {
subscriber.remove();
}
};
}, [shouldTrack, callback]);
return [err];
};
if (Object.keys(delivery_user).length > 0){
TaskManager.defineTask(LOCATION_TASK_NAME, ({ data, error }) => {
if (error) {
console.error(error);
return;
}
if (data) {
let latitude = data.locations[0].coords.latitude;
let longitude = data.locations[0].coords.longitude;
console.log(latitude, longitude);
dispatch(sendDeliveryGuyGpsLocation(auth_token, id, latitude, longitude, null))
// const location = data.locations[0];
// dispatch(addLocation(location));
}
});
}```