react-native-background-jobs

1.1.1 • Public • Published

react-native-background-jobs

Getting started

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

Mostly automatic installation

Linking is done automatically.

Usage

  1. Open up android/app/src/main/AndroidManifest
  • Add <service android:name="kendhia.reactlibrary.BackgroundJobsService" />.
  • Add the following permissions:
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
  1. Inside your index.js
    • Register the service the same way you register your app. AppRegistry.registerHeadlessTask('BackgroundJobsEvent', () => BackgroundJobsEvent);
    • Now, you can define the code you want to be running forever. Ex:
    const BackgroundJobsEvent = async () => {
        console.log("running forever...")
    };
    

// TODO:Enrich the Readme I know this readme file might not be so much understandable. I'll try to update it asap.

Dependencies (0)

    Dev Dependencies (10)

    Package Sidebar

    Install

    npm i react-native-background-jobs

    Weekly Downloads

    2

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    406 kB

    Total Files

    57

    Last publish

    Collaborators

    • kendhia