How to call API when App is killed in react native

2020-03-05 03:10发布

I Want to call API in the background when App killed and set the data in AsyncStorage. I used the following library but not working for me.

react-native-background-task

react-native-background-fetch

I want to called the API without time scheduling. The above both use the time Scheduling.

Please help me.

1条回答
乱世女痞
2楼-- · 2020-03-05 03:57

You would need to implement the componentWillUnmount method on the root of your app or use a library like realm to save the state throughout the use of your app.

Maybe worth checking out this answer

查看更多
登录 后发表回答