Javascript 关闭Expo客户端应用程序后,Expo backgroundFetch不工作

Javascript 关闭Expo客户端应用程序后,Expo backgroundFetch不工作,javascript,reactjs,react-native,ecmascript-6,expo,Javascript,Reactjs,React Native,Ecmascript 6,Expo,我正在开发一个应用程序,当用户关闭或导航到另一个应用程序时,我正在运行一些后台方法。 当我打开实际应用程序时,backgroundFetch工作正常,但当我关闭expo客户端应用程序时,它停止工作。我想在用户关闭expo客户端应用程序时运行一个特定的功能,我真的很努力,但没有找到任何解决方案。有人能帮我解决这个问题吗 const runBackgroundTask =async ()=> { const taskName='my_task'; const interva

我正在开发一个应用程序,当用户关闭或导航到另一个应用程序时,我正在运行一些后台方法。 当我打开实际应用程序时,
backgroundFetch
工作正常,但当我关闭expo客户端应用程序时,它停止工作。我想在用户关闭expo客户端应用程序时运行一个特定的功能,我真的很努力,但没有找到任何解决方案。有人能帮我解决这个问题吗

  const runBackgroundTask =async ()=> {
    const taskName='my_task';
    const interval=60

    TaskManager.defineTask(taskName, ()=>console.log('it working'));

    const status = await BackgroundFetch.getStatusAsync();
    switch (status) {
        case BackgroundFetch.Status.Restricted:
        case BackgroundFetch.Status.Denied:
            console.log("Background execution is disabled");
            return;

        default: {
            console.log("Background execution allowed");

            let tasks = await TaskManager.getRegisteredTasksAsync();
            if (tasks.find(f => f.taskName === taskName) == null) {
                console.log("Registering task");
                await BackgroundFetch.registerTaskAsync(taskName,{
                    minimumInterval: 60,
                    stopOnTerminate: false,
                    startOnBoot: true,
                });

                tasks = await TaskManager.getRegisteredTasksAsync();
                console.log("Registered tasks", tasks);
            } else {
                console.log(`Task ${taskName} already registered, skipping`);
                setInterval(() => {
                  console.log('I am calling')
                }, 500);
            }

            console.log("Setting interval to", interval);
            await BackgroundFetch.setMinimumIntervalAsync(interval);
        }
    }
  }