I'm trying to run javascript module twice a day in background, even if app is closed. I use BroadcastReceiver on Java side, but I don't know how to run javascript from onReceive() method without showing react View. I found one solution that run all application, but I'm looking for something like workers/service that will works in background.
public void onReceive(Context context, Intent intent) {
String pn = context.getApplicationContext().getPackageName();
Intent li = context.getPackageManager().getLaunchIntentForPackage(pn);
context.startActivity(li);
}
React Native 0.36 introduced Headless JS as a way to run tasks in JavaScript while your app is in the background.
You should take a look at this document.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With