mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #685] Android app: Open another application from user action #503
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#503
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 @FabianRig on GitHub (Mar 27, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/685
Hi!
Thank you for this awesome software!
I'm currently trying to add a user action for the android app (https://docs.ntfy.sh/publish/#open-websiteapp). Specifically, I'm trying to open another app (https://play.google.com/store/apps/details?id=io.homeassistant.companion.android).
Is it possible? If yes, what am I missing?
Thanks and best regards!
@cmeis commented on GitHub (Mar 28, 2023):
Unfortunately I don't have a lot of spare time right now. I had already started looking into something like this, but lost track. When looking for a solution I bookmarked this page: https://community.home-assistant.io/t/android-intents-sending-receiving-list-starting-activities-too/276192
I didn't get to test this, but it looks like the app could register to receive certain Android intents - which you should be able to create with an ntfy notification action (see here: https://docs.ntfy.sh/publish/#send-android-broadcast).
Perhaps this helps with experimenting?
@FabianRig commented on GitHub (Mar 28, 2023):
Thanks for the link!
While that might help for Home Assistant, it would work only for that. I'll look into it!
What I was hoping for is something like for the Home Assistant Companion app (https://companion.home-assistant.io/docs/notifications/actionable-notifications#android-android-specific). There you can add an action with "app://APPNAME" which opens the app directly.
I would use that function to open Home Assistant Companion, my Camera app (Unifi Protect) etc.
@binwiederhier Any chance that the code from the Home Assistant Companion app might work here, too?!
@wunter8 commented on GitHub (Mar 29, 2023):
I looked into updating the ntfy Android app to allow you to launch any app using a notification action. I ran into a few problems, so I stopped working on it.
I found this code in the Home Assistant Companion app. This is much simpler than what I was trying to do, so this would be very easy to implement. I'll try working on it when I have some free time
@FabianRig commented on GitHub (Mar 29, 2023):
That's very few lines of code. If I understood it correctly, you "only" need to call that function when the URI starts with "app://", correct?
I'll for sure be one of the future users. ;-) Thanks for looking into it!
@wunter8 commented on GitHub (Mar 29, 2023):
In the Home Assistant Companion app, yes, the "launchApp" function is called when the URI starts with
app://.However, in ntfy, I'm thinking of creating a new
action=appand just including the package name (e.g.,io.heckel.ntfy) in the existingintentfield.@binwiederhier What do you think? Should I add a new
packagefield instead of reusing theintentfield? Do you want the new action calledapp? Orlaunch? Or something else?@binwiederhier commented on GitHub (Mar 30, 2023):
So originally the app launch thingy was supposed to be part of the
viewaction. It is even documented like that here https://docs.ntfy.sh/publish/#open-websiteapp -- Apparently that doesn't work 😬I think I'm okay splitting it off into a new action, if it is distinct enough. Are there other things one can pass to an app? Intent extras and such? Something that actually justifies it to have a separate action?
If we do decide to go with a dedicated action, I think I'd name it
launch. If it's a dedicated action, and the field is "package", it should be calledpackage.@FabianRig commented on GitHub (Mar 30, 2023):
That is great news, nice! :-)
As far as I can tell from the Home Assistant Companion app (the only example I know which has this feature), there are basically two functions: one to just open an app and another to open a specific intent (see https://companion.home-assistant.io/docs/notifications/actionable-notifications).
It would be great if both functions where supported by the ntfy app, too. Just opening an app would be a great shortcut but directly jumping into an intent if necessary would be a great addition.
@binwiederhier commented on GitHub (Mar 31, 2023):
If there already is an intent:// scheme then it seems maybe the whole thing should be in the
viewaction after all; similar to HA'sURIaction:@wunter8 commented on GitHub (Mar 31, 2023):
Launching via intents only works for apps with specific AndroidManifest.xml definitions:
I think the same is true of apps that are launched via
app://through the browser@Marcool04 commented on GitHub (Jun 17, 2025):
Hi there.
First a very big thank you from me too for this amazing software.
I was just wondering if has anything has changed on this front since this oldish discussion? I am trying to get an app to open on android from a click on an action in a ntfy notification, but what I have tried so far isn't working...
I'm using the rust https://docs.rs/ntfy/ package, and the following:
produces a notification in ntfy on Android as expected, with a "View" button, but when one clicks on that, it fails with the following message:
Cannot open URL: [APP_NAME]://[ACTION].I have verified that the target app's
AndroidManifest.xmlcontains the following:Any hints would be really helpful here.
Cheers and thanks again for everybody's work here.