[GH-ISSUE #685] Android app: Open another application from user action #503

Open
opened 2026-05-07 00:24:52 +02:00 by BreizhHardware · 10 comments

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!

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!
Author
Owner

@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?

<!-- gh-comment-id:1486934054 --> @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?
Author
Owner

@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?!

<!-- gh-comment-id:1487290547 --> @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?!
Author
Owner

@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

<!-- gh-comment-id:1488771712 --> @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](https://github.com/home-assistant/android/blob/e1f797add7e0c11742e208d6d42f8816afe70fe2/app/src/main/java/io/homeassistant/companion/android/notifications/MessagingManager.kt#L1679-L1697) 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
Author
Owner

@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!

<!-- gh-comment-id:1489142806 --> @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!
Author
Owner

@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=app and just including the package name (e.g., io.heckel.ntfy) in the existing intent field.

@binwiederhier What do you think? Should I add a new package field instead of reusing the intent field? Do you want the new action called app? Or launch? Or something else?

<!-- gh-comment-id:1489434489 --> @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=app` and just including the package name (e.g., `io.heckel.ntfy`) in the existing `intent` field. @binwiederhier What do you think? Should I add a new `package` field instead of reusing the `intent` field? Do you want the new action called `app`? Or `launch`? Or something else?
Author
Owner

@binwiederhier commented on GitHub (Mar 30, 2023):

So originally the app launch thingy was supposed to be part of the view action. 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 called package.

<!-- gh-comment-id:1489545160 --> @binwiederhier commented on GitHub (Mar 30, 2023): So originally the app launch thingy was supposed to be part of the `view` action. It is even documented like that here https://docs.ntfy.sh/publish/#open-websiteapp -- Apparently that doesn't work :grimacing: 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 called `package`.
Author
Owner

@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).

You can also use an intent scheme URI to start an action in an installed application.

  • action: "URI"
    title: "Intent Scheme"
    uri: "intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end"

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.

<!-- gh-comment-id:1490776820 --> @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). > You can also use an [intent scheme URI](https://developer.chrome.com/docs/multidevice/android/intents/#syntax) to start an action in an installed application. > - action: "URI" > title: "Intent Scheme" > uri: "intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end" 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.
Author
Owner

@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 view action after all; similar to HA's URI action:

view, Open website, https://google.com
view, Open Twitter, app://com.twitter.android
view, Start some action, intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end
<!-- gh-comment-id:1491139778 --> @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 `view` action after all; similar to HA's `URI` action: ``` view, Open website, https://google.com view, Open Twitter, app://com.twitter.android view, Start some action, intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end ```
Author
Owner

@wunter8 commented on GitHub (Mar 31, 2023):

Launching via intents only works for apps with specific AndroidManifest.xml definitions:

Only activities that have the category filter, android.intent.category.BROWSABLE are able to be invoked using this method as it indicates that the application is safe to open from the Browser.

I think the same is true of apps that are launched via app:// through the browser

<!-- gh-comment-id:1491196580 --> @wunter8 commented on GitHub (Mar 31, 2023): Launching via intents only works for apps with specific AndroidManifest.xml definitions: > Only activities that have the category filter, [android.intent.category.BROWSABLE](http://developer.android.com/reference/android/content/Intent.html#CATEGORY_BROWSABLE) are able to be invoked using this method as it indicates that the application is safe to open from the Browser. I think the same is true of apps that are launched via `app://` through the browser
Author
Owner

@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:


// omitting boilerplate

let action = Action::new(
        ActionType::View,
        "View",
        Url::parse("[APP_NAME]://[ACTION]").expect("IMAP: Failed to parse URL for notification")
    ).clear(true);

let payload = ntfy::Payload::new(ntfy_topic)
    .actions([action]);

let ntfy_dispatcher = dispatcher::builder(ntfy_url)
    .build_async()
    .expect("NTFY: Failed to build ntfy dispatcher");

ntfy_dispatcher.send(&payload).await;

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.xml contains the following:

<intent-filter>
   <action android:name="android.intent.action.VIEW" />

   <data
       android:host="[ACTION]"
       android:scheme="[APP_NAME]" />
</intent-filter>

Any hints would be really helpful here.

Cheers and thanks again for everybody's work here.

<!-- gh-comment-id:2981142298 --> @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: ```rust // omitting boilerplate let action = Action::new( ActionType::View, "View", Url::parse("[APP_NAME]://[ACTION]").expect("IMAP: Failed to parse URL for notification") ).clear(true); let payload = ntfy::Payload::new(ntfy_topic) .actions([action]); let ntfy_dispatcher = dispatcher::builder(ntfy_url) .build_async() .expect("NTFY: Failed to build ntfy dispatcher"); ntfy_dispatcher.send(&payload).await; ``` 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.xml` contains the following: ```xml <intent-filter> <action android:name="android.intent.action.VIEW" /> <data android:host="[ACTION]" android:scheme="[APP_NAME]" /> </intent-filter> ``` Any hints would be really helpful here. Cheers and thanks again for everybody's work here.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#503
No description provided.