Sending notifications from your project to Android notification center.
Nodejs module for Sending notifications from your project to Android notification center by using termux-notification
and termux-toast
packges.
- Android Device.
- Termux & Termux:API Apps.
-
Install Termux:API app from F-Droid app or from GitHub repository.
-
Make sure that Termux:API app have a permission to send notifications.
-
Install
termux-notification
andtermux-toast
packges from Termux;-
pkg install termux-api
-
Install TermuxNotify into your project:-
-
With npm
npm i termux-notify
- With yarn
yarn add termux-notify
- Add TermuxNotify to your project
const termux = require('termux-notify');
TermuxNotify exports only one function.
Simple way
termux('Notification Message');
Advanced way
termux({
title: 'Notification Title',
message: 'Notification message',
image: 'assets/image.png', // You can use full path for image
}, function(err, log) {
err && console.log(log);
});
You can use status instead of image to show simple colored icons
- Status exampe:-
termux({
title: 'Notification Title',
message: 'Notification message',
status: 'success', // accepted values:- 'success', 'info', 'warning', 'danger'
}, function(err, log) {
err && console.log(log);
});
Toast messages:-
termux({
message: 'Notification message',
toast: true,
});
Want to get involved with Termux Notify? Here's how you can help.
Fork TermuxNotify, clone your fork, and configure the remotes:
# Get code from repostery
git clone https://github.com/<your-username>/termux-notify.git
# Change your way to cloned directory
cd termux-notify
# Configure the remotes
git remote add upstream https://github.com/alzintani/termux-notify.git
TermuxNotify 2024 Alzintani. Code released under the MIT license.