/rn-foreground-service

Foreground Service for React Native made with ❤

Primary LanguageJava

@supersami/rn-foreground-service 🤟

A foreground service with headless task that can manage multiple headless tasks execution at the same time and handle interactions. 🎉

react-browser-tab DEMO

When to use this ?

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 JavaScript Style Guide

Install

npm i @supersami/rn-foreground-service

Usage

Register a Headless Task

import ReactNativeForegroundService from "@supersami/rn-foreground-service";
ReactNativeForegroundService.register();
AppRegistry.registerComponent(appName, () => App);

Add a Task

ReactNativeForegroundService.add_task(() => console.log("I am Being Tested"), {
  delay: 100,
  onLoop: true,
  taskId: "taskid",
  onError: (e) => console.log(`Error logging:`, e),
});

Starting Foreground service

ReactNativeForegroundService.start({
  id: 144,
  title: "Foreground Service",
  message: "you are online!",
});

You can learn more about Rn-foreground-service.

License

MIT © rajaosama