Hi @Brian_Carpenter,
Nothing really special. You need a notification service; i use pushover.net but you may use anyone like signals/twilio.
You create device(s) that will receive the notification, in the notification service backend.
Then, you install the app on your device. And in your ignition project, just create a script like this one (for pushover):
#notify mobile using Pushover service
url = "https://api.pushover.net/1/messages.json"
contentType = "application/json"
brutData = {
"token": "Blah blah",
"user": "Blah blah",
"device": "gng-ipx",
"title": "Ignition",
"message": "Notification service is live!"}
postData = jsonString = system.util.jsonEncode(brutData)
result = system.net.httpPost(url, contentType, postData)
Token, user, device are coming from the notification backend service.
Hope this help.
i am very new to ignition. does this script go in the webdev section?
Hi,
Sorry for the delay… this script is just regular gateway script. You can then call it from where you need it.
Hi, we are also currently looking into a solution for push notifications, and ntfy.sh and pushover.net are both promising for the time being. But on my journey I may have found a solution for the problem @paul-griffith described:
As I understand it, this just isn't something Android/iOS support. I believe you have to register, in a 'static' resource bundle/manifest/whatever, what the 'source' of any notifications for your app will be. There's no way to dynamically configure it once the app is compiled.
Disclaimer: I could be completely wrong, but that's not too uncommon.
During research around ntfy I stumbled over UnifiedPush. It offers a way to send push notifications via the users preferred notification system. It needs a second app on the phone, for example ntfy or gotify or sunup, which has the "distributor" role. The app, in this case igniton can search for available distributors, and ask the distributor for a channel. It receives a url to which the ignition gateway can send messages via WebPush, a well known standard for push notifications to browsers. When the message is send, ignition gives away control over how the message is delivered. It could be over firebase cloud messaging, could be over long lived websockets, depends on which distributor and push server the client uses/allows. The app working as the distributor then receives the message over said channel, and sends a message to the ignition app, which is woken up by the os and can then create a notification which is displayed on the users screen/notification bar.
As far as I understand the message is usually encrypted on the application server (Gateway) and decrypted on the application client (Perspective App), so that the contents are unreadable for the distributor and push server.
This system is already in use with Mastodon or Elements (Matrix chat client) and multiple other fediverse apps, so I think it has proven to be a viable system. And since multiple apps can share the same distributor and thus the same delivery method, battery drain is better compared to every app using its own long lived connection and background service.
I would be interested to hear opinions on such a setup?
UnifiedPush only works for Linux/Android clients right now. Probably possible to support Web/Windows as well, but iOS doesn't allow the running of background services, so there is no way to "wake up" the iOS device using UnifiedPush the same way APN does