A foreground service with headless task that can manage multiple headless tasks execution at the same time and handle interactions. 🎉
If you want a foreground service in react native, RN-foreground-service is the way to go. This plugin handels Headless task, multiple task, notification customization, and notification interactions.
npm i @supersami/rn-foreground-service
import ReactNativeForegroundService from "@supersami/rn-foreground-service";
ReactNativeForegroundService.register();
AppRegistry.registerComponent(appName, () => App);
ReactNativeForegroundService.add_task(() => console.log("I am Being Tested"), {
delay: 100,
onLoop: true,
taskId: "taskid",
onError: (e) => console.log(`Error logging:`, e),
});
ReactNativeForegroundService.start({
id: 144,
title: "Foreground Service",
message: "you are online!",
});
You can learn more about Rn-foreground-service.
MIT © rajaosama