Firebase Cloud Messaging server and Android application for sending push notifications from command-line to mobile devices. This is a fork of the original notify application, modified and customized for personal purposes. I advise not to use this, but instead try the original app which is great and supported.
These steps were necessary to implement it on Debian 8.10 Jessie.
- OpenJDK 1.8 (
sudo apt-get install -t jessie-backports openjdk-8-jdk) - NodeJS v6.11.2 (nodejs_6.11.2-1nodesource1~jessie1_amd64.deb)
- NPM v5.8.0 (
sudo npm install -g npm@5.8.0)
Optionally to avoid the "sudo-hell" with 'npm' run this below:
mkdir -p ~/.npm-packages/bin && npm config set prefix ~/.npm-packages && npm list -g --depth=0 && echo -e "\nexport PATH=$HOME/.npm-packages/bin:\$PATH" >> ~/.bashrc && source ~/.bashrcnpm install -g firebase@4.5.2npm install -g firebase-tools@3.13.1cd functions && npm installfirebase loginfirebase deploy
npm installnpm start
Compiles fine for sure with Android Studio 3.0.1
Using notify is simple. When the app installed and launched on the Android device, it will give a unique token. This token is how the device is identified by the server.
Node JS client (clients/node):
The notify-client is written with node, so it can be installed with npm, then it is available system-wide as command:
npm install -g
notify -r $TOKEN
notify -i $TITLE -t $MESSAGEShell Script (clients/sh):
chmod +x notify.sh
./notify.sh -r $TOKEN
./notify.sh -t $MESSAGEcURL:
curl "https://us-central1-notify-58.cloudfunctions.net/sendNotification?to=$TOKEN&title=$TITLE&text=$MESSAGE"PHP:
file_get_contents("https://us-central1-notify-58.cloudfunctions.net/sendNotification?to=$TOKEN&title=$TITLE&text=$MESSAGE")Pilight Event (clients/pilight):
It is included in the pilight-kontrol only.
IF 1 == 1 THEN pushover TITLE Doorbell rang MESSAGE Doorbell rang TOKEN abcd123abc
You will receive a push notification to your phone when the command has completed, regardless of whether or not it was successful:
someLongRunningCommand && notifyMost of the credits goes to the original author: Kevin Bedi