How to run Background services in React Native app

| By Webner

Steps to run Background Services in React Native app

React-native-background-task is a library which can execute a function when the app is closed or in background, no more frequently than every 15 minutes.


$ npm install react-native-background-task --save


1. The linking of the library can be done automatically by running:

$ react-native link react-native-background-task

2. One manual step is still needed – in your project file android/app/src/main/java/myapp/, add the following to the end of the onCreate() method:



For iOS support, this library relies on version 2.0.x of react-native-background-fetch which can be installed as follows:

$ npm install react-native-background-fetch@2.0.x --save
$ react-native link react-native-background-fetch

This library will behave correctly on iOS as long as react-native-background-fetch is installed alongside it, and has been linked with your project.
To check debugging in android

$ adb logcat *:S ReactNative:V ReactNativeJS:V BackgroundTask:V


run Background services in React Native app

Leave a Reply

Your email address will not be published. Required fields are marked *