[expo-task-manager] Is it Possible to re-trigger TaskManager.defineTask event manually

I am facing some issues with the expo-task manager. when the app is killed or closed from the background and if I changed the location of the app then TaskManager.defineTask event didn’t trigger automatically. but it works perfectly when the app is in background. so after re-launch, the app from the killed state then again TaskManager.defineTask triggered successfully.

I have triggered pusher-event inside TaskManager.defineTask to update location of app-user in server.

I have assigned pusher-event in global keyword of javascript because we have defined TaskManager.defineTask event outside from component. so for using pusher-event outside of component we defined globally.

Now issue arises on iOS that TaskManager.defineTask event triggered first and after that useEffect inside of functional component triggered and inside useEffect we assigned pusher-event.

so when TaskManager.defineTask triggered at that time pusher event is undefined and it causes not triggering pusher event and that’s why my app user current location would not updating on server.

// 1st triggered below TaskManager event after that below useEffect triggered
const App = () => {
  useEffect(() => {
  pusher.current = new Pusher(Config.PUSHER_KEY, {
      cluster: Config.PUSHER_CLUSTER,
      authEndpoint: `${Config.API_URL}/api/v1/pusher_authentications`,
      auth: {
        headers: {
          Authorization: authToken,
          'APP-TOKEN': Config.APP_TOKEN,
// assigning pusher event
    global.gChannel = pusher.current.subscribe('all-drivers');
}, [authToken]);
// 1st triggered this event

TaskManager.defineTask(LOCATION_TASK_NAME, ({ data: { locations }, error }) => {
  try {
    if (error) {

    const {
      coords: { latitude, longitude },
    } = locations[0];

    //global.gChannel -->>> undefined 

    if (global.gChannel) {
      global.gChannel.trigger('update-user-location', {
        latitude: latitude,
        longitude: longitude,
        id: global.gUserId,
  } catch (e) {

Issuee only persist on iOS and only when we launch the app from the killed state.so is there any solution how to fix above problems?

My working environments

"pusher-js": "^7.0.0",
 "react": "16.13.1",
 "react-native": "0.63.2",
"expo-task-manager": "~8.5.0",
 "react-native-unimodules": "^0.11.0",

Platform : iOS