react-native-background-task icon indicating copy to clipboard operation
react-native-background-task copied to clipboard

Register Headless js

Open valiaghaei opened this issue 5 years ago • 1 comments

Hi it does not work for me and I got warning register headless js , i want to run this code in background BackgroundTask.define(() => { console.log('Hello from a background task'); BackgroundTask.finish(); }); but I do not you what exactly should i register in headless js ? could you please anyone help me

valiaghaei avatar Nov 29 '20 19:11 valiaghaei

As per -> https://github.com/jamesisaac/react-native-background-task#android

Android

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

react-native link react-native-background-task

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

BackgroundTaskPackage.useContext(this);

vestronv avatar Sep 02 '21 11:09 vestronv