diff --git a/docs/static/img/android-screenshot-macrodroid-action.jpg b/docs/static/img/android-screenshot-macrodroid-action.jpg new file mode 100644 index 00000000..c0198a15 Binary files /dev/null and b/docs/static/img/android-screenshot-macrodroid-action.jpg differ diff --git a/docs/static/img/android-screenshot-macrodroid-overview.jpg b/docs/static/img/android-screenshot-macrodroid-overview.jpg new file mode 100644 index 00000000..be56da30 Binary files /dev/null and b/docs/static/img/android-screenshot-macrodroid-overview.jpg differ diff --git a/docs/static/img/android-screenshot-macrodroid-trigger.jpg b/docs/static/img/android-screenshot-macrodroid-trigger.jpg new file mode 100644 index 00000000..36c2b7e4 Binary files /dev/null and b/docs/static/img/android-screenshot-macrodroid-trigger.jpg differ diff --git a/docs/static/img/android-screenshot-muted.png b/docs/static/img/android-screenshot-muted.png new file mode 100644 index 00000000..b9c740e5 Binary files /dev/null and b/docs/static/img/android-screenshot-muted.png differ diff --git a/docs/static/img/android-screenshot-tasker-action-edit.jpg b/docs/static/img/android-screenshot-tasker-action-edit.jpg new file mode 100644 index 00000000..2be5dbe6 Binary files /dev/null and b/docs/static/img/android-screenshot-tasker-action-edit.jpg differ diff --git a/docs/static/img/android-screenshot-tasker-event-edit.jpg b/docs/static/img/android-screenshot-tasker-event-edit.jpg new file mode 100644 index 00000000..a24a2940 Binary files /dev/null and b/docs/static/img/android-screenshot-tasker-event-edit.jpg differ diff --git a/docs/static/img/android-screenshot-tasker-profiles.jpg b/docs/static/img/android-screenshot-tasker-profiles.jpg new file mode 100644 index 00000000..dc8c14aa Binary files /dev/null and b/docs/static/img/android-screenshot-tasker-profiles.jpg differ diff --git a/docs/static/img/android-screenshot-tasker-task-edit.jpg b/docs/static/img/android-screenshot-tasker-task-edit.jpg new file mode 100644 index 00000000..44db5808 Binary files /dev/null and b/docs/static/img/android-screenshot-tasker-task-edit.jpg differ diff --git a/docs/subscribe/phone.md b/docs/subscribe/phone.md index c97a8f53..48cbb2ab 100644 --- a/docs/subscribe/phone.md +++ b/docs/subscribe/phone.md @@ -3,7 +3,6 @@ You can use the [ntfy Android App](https://play.google.com/store/apps/details?id notifications directly on your phone. Just like the server, this app is also [open source](https://github.com/binwiederhier/ntfy-android). Since I don't have an iPhone or a Mac, I didn't make an iOS app yet. I'd be awesome if [someone else could help out](https://github.com/binwiederhier/ntfy/issues/4). -## Android @@ -11,7 +10,7 @@ You can get the Android app from both [Google Play](https://play.google.com/stor from [F-Droid](https://f-droid.org/en/packages/io.heckel.ntfy/). Both are largely identical, with the one exception that the F-Droid flavor does not use Firebase. -### Overview +## Overview A picture is worth a thousand words. Here are a few screenshots showing what the app looks like. It's all pretty straight forward. You can add topics and as soon as you add them, you can [publish messages](../publish.md) to them. @@ -30,7 +29,7 @@ If those screenshots are still not enough, here's a video:
Sending push notifications to your Android phone
-### Message priority +## Message priority When you [publish messages](../publish.md#message-priority) to a topic, you can define a priority. This priority defines how urgently Android will notify you about the notification, and whether they make a sound and/or vibrate. @@ -50,7 +49,7 @@ the settings (and custom sounds or vibration) for each of the priorities:
Per-priority sound/vibration settings
-### Instant delivery +## Instant delivery Instant delivery allows you to receive messages on your phone instantly, **even when your phone is in doze mode**, i.e. when the screen turns off, and you leave it on the desk for a while. This is achieved with a foreground service, which you'll see as a permanent notification that looks like this: @@ -69,8 +68,8 @@ To do so, long-press on the foreground notification (screenshot above) and navig
Turning off the persistent instant delivery notification
-### Limitations without instant delivery -Without instant delivery, **messages may arrive with a significant delay** (sometimes many minutes, or even hours later). If you've ever picked up your phone and +**Limitations without instant delivery**: Without instant delivery, **messages may arrive with a significant delay** +(sometimes many minutes, or even hours later). If you've ever picked up your phone and suddenly had 10 messages that were sent long before you know what I'm talking about. The reason for this is [Firebase Cloud Messaging (FCM)](https://firebase.google.com/docs/cloud-messaging). FCM is the @@ -80,6 +79,77 @@ notifications. Firebase is overall pretty bad at delivering messages in time, bu The ntfy Android app uses Firebase only for the main host `ntfy.sh`, and only in the Google Play flavor of the app. It won't use Firebase for any self-hosted servers, and not at all in the the F-Droid flavor. +## Integrations +The ntfy Android app integrates nicely with automation apps such as [MacroDroid](https://play.google.com/store/apps/details?id=com.arlosoft.macrodroid) +or [Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm). Using Android intents, you can +**react to incoming messages**, as well as **send messages**. + +### React to incoming messages +To react on incoming notifications, you have to register to intents with the `io.heckel.ntfy.MESSAGE_RECEIVED` action (see +[code for details](https://github.com/binwiederhier/ntfy-android/blob/main/app/src/main/java/io/heckel/ntfy/msg/BroadcastService.kt)). +Here's an example using [MacroDroid](https://play.google.com/store/apps/details?id=com.arlosoft.macrodroid) +and [Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm), but any app that can catch +broadcasts is supported: + +
+ + + + + + + +
+ +For MacroDroid, be sure to type in the package name `io.heckel.ntfy`, otherwise intents may be silently swallowed. +If you're using topics to drive automation, you'll likely want to mute the topic in the ntfy app. This will prevent +notification popups: + +
+ ![muted subscription](../static/img/android-screenshot-muted.png){ width=500 } +
Muting notifications to prevent popups
+
+ +Here's a list of extras you can access. Most likely, you'll want to filter for `topic` and react on `message`: + +| Extra name | Type | Example | Description | +|---|---|---|---| +| `id` | *string* | `bP8dMjO8ig` | Randomly chosen message identifier (likely not very useful for task automation) | +| `base_url` | *string* | `https://ntfy.sh` | Root URL of the ntfy server this message came from | +| `topic` ❤️ | *string* | `mytopic` | Topic name; **you'll likely want to filter for a specific topic** | +| `muted` | *bool* | `true` | Indicates whether the subscription was muted in the app | +| `muted_str` | *string (`true` or `false`)* | `true` | Same as `muted`, but as string `true` or `false` | +| `time` | *int* | `1635528741` | Message date time, as Unix time stamp | +| `title` | *string* | `Some title` | Message [title](../publish.md#message-title); may be empty if not set | +| `message` ❤️ | *string* | `Some message` | Message body; **this is likely what you're interested in** | +| `tags` | *string* | `tag1,tag2,..` | Comma-separated list of [tags](../publish.md#tags-emojis) | +| `tags_map` | *string* | `0=tag1,1=tag2,..` | Map of tags to make it easier to map first, second, ... tag | +| `priority` | *int (between 1-5)* | `4` | Message [priority](../publish.md#message-priority) with 1=min, 3=default and 5=max | + +### Send messages using intents +To send messages from other apps (such as [MacroDroid](https://play.google.com/store/apps/details?id=com.arlosoft.macrodroid) +and [Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm)), you can +broadcast an intent with the `io.heckel.ntfy.SEND_MESSAGE` action. In Tasker, you can alternatively use the "HTTP Request" +action, which may be a little easier and also works if ntfy is not installed. + +Here's what that looks like: + +
+ + +
+ +The following intent extras are supported when for the intent with the `io.heckel.ntfy.SEND_MESSAGE` action: + +| Extra name | Required | Type | Example | Description | +|---|---|---|---|---| +| `base_url` | - | *string* | `https://ntfy.sh` | Root URL of the ntfy server this message came from, defaults to `https://ntfy.sh` | +| `topic` ❤️ | ✔ | *string* | `mytopic` | Topic name; **you must set this** | +| `title` | - | *string* | `Some title` | Message [title](../publish.md#message-title); may be empty if not set | +| `message` ❤️ | ✔ | *string* | `Some message` | Message body; **you must set this** | +| `tags` | - | *string* | `tag1,tag2,..` | Comma-separated list of [tags](../publish.md#tags-emojis) | +| `priority` | - | *string or int (between 1-5)* | `4` | Message [priority](../publish.md#message-priority) with 1=min, 3=default and 5=max | + ## iPhone/iOS I almost feel devious for putting the *Download on the App Store* button on this page. Currently, there is no iOS app for ntfy, but it's in the works. You can track the status on GitHub.