Android live notifications are now in core!

notifications

(Jeff Wong) #1

On mobile browsers that support it*, the live notifications feature is now available!

To turn on notifications, navigate to your user preferences, and hit “enable notifications” just as you would on desktop.

You will receive a confirmation notification if all went well.

Admin options

There are two new admin options, the push notifications prompt, and the push notifications icon url

push notifications prompt

Adds a consent prompt asking a user to turn on notifications. This will only appear once the user has at least one post or reply.

push notifications icon url

This should be a transparent monochrome icon that will be displayed with the push notification, and will display in the top bar when the notification bar is minimized.

Push notifications plugin

This feature is a migration and integration of the push notifications plugin. This integration is intended to simplify notifications as a single button to enable notifications for both desktop and mobile devices (desktop notifications for desktop, and push notifications for mobile) and support mobile notifications by default.

If you have been using the push notification plugin previously to allow notifications for android devices, this plugin is no longer required.

In the event that you would like to give the choice to enable push notifications on desktop, this plugin has been redesigned to handle this.

*This feature is currently Android only. Supported browsers are those that support ‘push notifications api’.


Push notifications on Android (non-hosted sites)
Discourse Push Notifications for Desktop
Notifications are not displayed in the App
(Alessio Fattorini) #2

Great feature! Beta9 or 10?


(Jeff Wong) #3

It will be available in beta10, it didn’t quite make it into beta9


(Alessio Fattorini) #4

I’m upgrading to the last commits :wink:


(Gerhard Schlager) #5

Would it be possible to suppress the banner inside the Android app?


(Jeff Wong) #6

ah, hm, that’s a good point - it would depend on if we can somehow detect if we’re there through the app, which may be nontrivial. I know @falco wants the banner there by default but maybe it might be better to leave the banner off by default until those sorts of corner cases are a little clearer.


(Alessio Fattorini) #7

Looks like it doesn’t work for me :-
No banner on android or on chrome
What can I check?


(Rafael dos Santos Silva) #8

It’s disabled by defaut. Enable it on push notifications prompt.

I found a way to do it using a webview, but no way to do it on Chrome Custom Tabs.


(Sam Saffron) #9

I think we can do it per:

We just need to amend the Android app.


(Rafael dos Santos Silva) #10

Nice find!

So we can check for header in the app in ruby-land, and add a special CSS class in the body for app views :slight_smile:.


(Alessio Fattorini) #11

I did it. Nothing changed


(Sarah) #12

Hmm I seem to only be getting push notifications through chrome and not the Discourse app.

I have enabled all notifications in my android app settings, my phone is not on ‘do not disturb’ mode.

If I am in the Discourse app and I toggle the ‘enable notifications’ button in my user settings, I get a notification from the app. But any reply on topics etc… are through chrome :confused: I would prefer that when I click on a notification, that it goes to the Discourse app.

Any suggestions?


(Rafael dos Santos Silva) #13

Our app support live notifications for Android and iOS, but only for our hosted customers.

This topic talks about Android Chrome and Firefox web push notifications, that work for everyone since they use this open web protocol.


(Alex) #14

How can we get live notifications if we are self-hosted?


(Bhanu Sharma) #15

You just have to go to your profile preferences on mobile and enable notifications.


(Jeff Wong) #16

If it’s about the web app, this topic is exactly that - everyone gets live notifications, with the addition of Android! :tada:

If you’re talking about the app you install on your phone, this is off topic - I know someone has had success by forking and created their own app, but that isn’t a well trodden path…


(Yihan "Misaka 0x4e21" X.) #17

I encountered a problem that notifications are unable to be received on Chrome Android.

When I enable Live Notification, there will be a result of PushNotificationPusher.subscriptions run in rails c. However, that method will return [] after a notification is sent. No error shown in /logs. Nothing in chrome://gcm-internals on Chrome Android.

I wonder whether it is a bug in Discourse or in my configuration, or some network trouble in China where Google is blocked. (GCM / FCM is not blocked and proxies / VPNs don’t help.)
Does it work for those who have direct connection with Google?

Discourse 2.0.1
Chrome Android 67.0.3396.87


(Rafael dos Santos Silva) #18

Push notifications are working fine for me here, do you use the “Google Android” with Play Services and everything?

I think Play Services are required for push.

Also, you may try with Firefox for Android just to see if it’s only Chrome that is affected.


(Yihan "Misaka 0x4e21" X.) #19

Play Services are installed on my phone and *#*#426#*#* shows CONNECTED.

Firefox for Android works.

By the way, I tried Simple Push Demo on Chrome Android, and it works.