Custom timer notification for React Native Android 🔔
npm install react-native-custom-timer-notification
AndroidManifest
<receiver android:name="com.reactnativecustomtimernotification.NotificationEventReceiver" />
<receiver android:name="com.reactnativecustomtimernotification.OnClickBroadcastReceiver" />
<!--
if foreground service used add this line
-->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<service android:name="com.reactnativecustomtimernotification.ForegroundService"/>
payload
sent will be received when click or canceled
title
Title of the notification
body
Body of the notification
id
unique number
sec
Time in seconds
import { TimerNotification, onEvent } from "react-native-custom-timer-notification";
// ...
// onclick and cancel listner
onEvent(event=>{
console.log(event)
});
const result = await TimerNotification({
payload: JSON.stringify("notificationOpen?.data"),
title: "My notification",
body:"Much longer text that cannot fit one line... ",
id: 1,
sec:60,
remove:false, // optional
foreground:false,
})
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT