How to call API when App is killed in react native?

自作多情 提交于 2019-12-06 07:37:52

问题


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:


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



来源:https://stackoverflow.com/questions/51023044/how-to-call-api-when-app-is-killed-in-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!