Android live notifications are now in core!

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’.

34 Likes

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

3 Likes

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.

4 Likes

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

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.

4 Likes

I think we can do it per:

We just need to amend the Android app.

7 Likes

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

4 Likes

I did it. Nothing changed

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?

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.

5 Likes

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

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

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…

6 Likes

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

3 Likes

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.

3 Likes

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.

5 Likes

I have tried to do the steps to activate the push notifications url icon.

I want the push notifications url icon and push notifications prompt to work together, but only the push notifications prompt works.

I have never gotten a push notification url icon on my Android

Are there any settings that have been missed?

Thank you so much for your help.

2 Likes

Notifications were broken for sites updated in the last 25 hours. Please update your site later today and try again.

7 Likes

So all pushed messeage where send over google. The Push notification is an google-service only right?