mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #31] Android automation apps integration (Tasker, MacroDroid, Automate, ...) #25
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @FrameXX on GitHub (Dec 4, 2021).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/31
Hi! I am the guy from Reddit!
Android automation apps are tools that helps you automate your android smartphone. They are like simple automation programming. There's a lot of them. Most known is Tasker, but also MacroDroid and Auomate too and there's also lot of other.
I see big potential in communicating between devices throught ntfy.sh. Of course many of these apps have their own solution, for example MacroDroid runs its own webhook server and there's a lot of other solutions for Tasker, but one more option is always good and your service seems to have a lot of more options. SO NOW TO THE POINT.
HOW TO INTEGRATE NFTY WITH AUTOMATIZATION APPS
As I mentioned before MacroDroid is able to use curl, but I don't know Tasker or any else, but they propably should also be able to.
There are 2 best ways how to integrate nfty with automatization apps
Here is official video on how to create a Tasker pugin
https://piped.kavin.rocks/watch?v=48IVJgDtu6Y
However in this case I think intent solution would be much more simple and also more could make use of it. Tasker plugin is good for advanced triggers and actions, with a lot of data, but for something simple like messages it's not propably needed. Also more apps that doesn't work with Tasker plugins could make use of it.
let me give an EXAMPLE OF BROADCAST intent after message is received. I am an amateur so forgive me any mistakes. I am not writing in code, just showing what should intent contain.
Action: io.heckel.ntfy.messageReceived
Extra 'topic': my_custom_topic
Extra 'title': my_custom_title
Extra 'priority': 3
Extra 'tags': warning,skull
Extra 'message': my_custom_message
One note. There should be a ability to turn this intent broadcasting on and off, so any unwanted apps couldn't catch or send intents and misuse the ability.
@FrameXX commented on GitHub (Dec 4, 2021):
Also. I personally wanted to not use app, but just fetch for messages every 5 min or so with curl, because that's enough for my purpose and I don't need instant delivery (but some users might want, that's why I opened this issue). So I tryed curl:
curl -s "ntfy.sh/mytopic/json?since=all"but it won't return me any data. (No, I didn't forgot to change mytopic to my real topic.) I also tryed changing json to raw but it didn't helped. Am I doing something wrong?
EDIT: It was MacroDroid fault. Your command works, I tryed it in another shell app.
@binwiederhier commented on GitHub (Dec 4, 2021):
Thank you very much for the write-up and the fantastic explanation.
I love the idea of just broadcasting an intent and thereby integrating with other apps. It's easy and gets the job done.
I'll certainly do that when I get to it. Sounds like a fantastic feature!
😢 May I ask what the reason is? You don't like the foreground service?
The smallest possible interval that Android allows (without a foreground service) is 15 minutes (via
WorkManager). I had plans to allow people to configure an interval to let them choose:But I haven't gotten to that yet. (Edit: Just created a ticket: https://github.com/binwiederhier/ntfy/issues/32)
This will keep the connection open forever, so unless you send messages to the topic it won't return anything other than the open message and the other messages already in the channel:
If you want the connection to terminate after, you can add
poll=1, like this:Or are you saying you're not receiving ANY output from the
curl? May I suggest you drop the-sand maybe do acurl -v, like this:That'll show any errors.
@FrameXX commented on GitHub (Dec 4, 2021):
Your app is totally fine (just f-droid version seems to be a little broken). I have budget phone from 2018 and I have already some apps using foreground services, so I searched for an option without another foreground service. I may still use the app, I will see, but it's always good to know what all options I have. I was just discovering if this is a possibility. Also polling for messages like this doesn't require Google Play services (,which I have on my phone, but some people may not).
Thank you! Adding poll=1 helped and I get the output.
@binwiederhier commented on GitHub (Dec 6, 2021):
Oh no. I just remembered this, sorry it took so long.
Can you elaborate on how it is broken? Can you maybe describe or take a video. I'd love to fix this if this is an issue.
So the only option to do this without another foreground service and without FCM is with polling every X minutes. With
WorkManager(which is the only approved way these days), you can check only every 15 minutes. That's the shortest interval that you can set. Everything else won't work.My plan is to do this as part of https://github.com/binwiederhier/ntfy/issues/10 is this:
Per subscription, allow you to set:
I can imagine that even the "Check every 5 minutes" option will likely consume almost no battery, since the majority of the time we're just sleeping.
@FrameXX commented on GitHub (Dec 7, 2021):
It's missing an option of instant delivery when adding a topic,
which I would understand (I presume it's because it does not use Google Play Services), but after creating a subscription it shows a persistent notification that states 'You are subscribed to one instant delivery topic', which is kind of confusing because I know delivery should not be instant. But what I don't know is that there will be no notification delivery at all. I don't know what poll time is used by default if any, but I send message to topic, waited 5 minutes and nothing happened. It won't send me the notification and I need to open the app to see the message and even after opening theOKAY, so notifications started suddenly working and they are instant.
I swear they didn't worked before.(My bad. I am suspicious that I had do not disturb mode on, which bloked notifications from showing up).But still there are some weird things. As I stated there's missing an option on instant delivery and it seems to be instant by default. When I am on topic messages page and tap on lightning icon in top menu it does nothing and just says that instant delivery is enabled. Overally f-droid version has less options? Why? Is it that you updated the app, but f-droid repository didn't updated since?
So this all seems to be just my own stupidity after all. Sorry for wasting your time with this.
Totally understand
@binwiederhier commented on GitHub (Dec 7, 2021):
Oh this is a clue. I will investigate that.
I also had the suspicion that if you mess with the "Subscription Service" notification channel as described here (https://ntfy.sh/docs/subscribe/phone/#instant-delivery), ie. when you toggle the "Subscription Service" off, that that actually messes with the foreground service. But it's only a suspicion.
Yey :-D
Okay so this is a UI issue that knew may cause confusion, but I wanted the F-Droid version out, ...
The thing is this:
On Google Play, if you use ntfy.sh, you have the choice between instant or not, because of Firebase, so the "[ ] Instant delivery" checkbox is there.
On F-Droid, even when using ntfy.sh, because we don't have Firebase, the "[ ] Instant delivery" is not there, because ALL subscriptions are "instant delivery".
Bottom line: I agree that this is terribly confusing, and I will revamp this when I get to https://github.com/binwiederhier/ntfy/issues/32, i.e. what I described here: https://github.com/binwiederhier/ntfy/issues/31#issuecomment-987113837
@binwiederhier commented on GitHub (Dec 10, 2021):
As per the conversation in https://www.macrodroidforum.com/index.php?threads/ntfy-sh-update-post.1531/, I'm reposting what was discussed there:
@binwiederhier commented on GitHub (Dec 11, 2021):
Pretty much done:
github.com/binwiederhier/ntfy-android@323e013391@binwiederhier commented on GitHub (Dec 11, 2021):
I'll leave this open until it's released and tested
@binwiederhier commented on GitHub (Dec 13, 2021):
Done in 1.4.0
@lhtdung commented on GitHub (Mar 30, 2024):
Good