Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register Headless js #84

Open
valiaghaei opened this issue Nov 29, 2020 · 1 comment
Open

Register Headless js #84

valiaghaei opened this issue Nov 29, 2020 · 1 comment

Comments

@valiaghaei
Copy link

valiaghaei commented Nov 29, 2020

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

@vestronv
Copy link

vestronv commented Sep 2, 2021

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants