简体   繁体   中英

React Native - Background services

I am developing an app using React-Native, and I need to add a background service to check notifications. And I have tried almost all the solutions including Headless JS in the internet and I still couldn't make it. Maybe I'm doing it in a wrong way. Can anybody suggest me anything? (Even when the app is not open)

There are many packages to use which will help you achieve this. As you have not mentioned any of the used packages ill suggest some:

  1. https://hackernoon.com/easy-os-background-tasks-in-react-native-bc4476c48b8a

  2. https://www.npmjs.com/package/react-native-background-job

  3. https://www.npmjs.com/package/react-native-background-task

I have used following packages for a Radio app in React native. the following packages helped me achieve all the background related activites even when the app was minimized and another app was used(App running in background process).

"dependencies": {

    "mobx": "^4.1.1",

    "mobx-react": "^5.0.0",

    "native-base": "^2.11.0",

    "react": "16.6.3",

    "react-native": "0.58.6",

    "react-native-gesture-handler": "^1.0.15",

    "react-native-swift": "^1.2.2",

    "react-native-track-player": "^1.1.2",

    "react-navigation": "^3.3.0"

  }, 

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