简体   繁体   中英

Run background task on ios - react native 0.60

I would like to execute a piece of code just after my application goes into the background.

From what I read this is possible with the use of the library react-native-fetch-background (At the beginning I wanted to do it for iOS) but this feature is limited.

I will have to wait for at least 15 since the app enters background to execute the task, but I care for this code to be executed just after my app goes into background.

Is there any way of doing this?

Not sure about react-native native implementation but using your own code in file AppDelegate.m callback method

- (void)applicationWillResignActive:(UIApplication *)application {
      //notify react native about app goes into the background
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM