Liferay Push

Hello, community! We would like to announce Liferay Push, our new framework for sending push notifications from Liferay Portal to your mobile apps.


Push notifications is a technology that allows servers to broadcast messages to mobile devices. Instead of having your app poll the server for new messages every few seconds (that drains your phone battery and your monthly data plan!), your app can just wait for notifications from the server. Your app will be notified even when it's not running, the system will wake it up.

 

Engaging your audience

 

Say you've developed your own company newsletter portlet and its corresponding mobile app for your customers. You can use Liferay Push to notify users on their mobile devices whenever a new post is published. That way your users will always be up-to-date without ever needing to open their app and refresh it.


Push notifications are usually associated with the notifications you receive on your phone notifications center but push notifications offer much more than that. With Liferay Push you can update the content on your apps or update its local database as change happen.

 

Currently, Liferay Push supports two push notification providers: Google and Apple. However, Liferay Push can be extended to support more platforms as needed. Liferay Push allows each user to register one or more devices. Liferay Push will query for the registered devices, identify if the user is using an Android or iOS device and send the notification to the right provider. Notifications can be sent to one or many users.


How does it work?


Here are some diagrams that explain how Liferay Push works:


  1. Your phone app must register the user’s device to the portal.

 

 


 

2. Once a user’s devices are registered, your portlet or plugin can send notifications to them.


 



 

Liferay Push provides both server side and client side APIs (Android and iOS). It will help to get up to speed and make it easier to support push notifications in your apps.


Liferay Push is now available at the Liferay Marketplace as a Liferay Labs app. Check out the documentation and give us feedback!

 

更多博文

博客
Great news Bruno! Thats! Such an interesting feature.

In my last developments I made a hybrid strategy choice instead of native (Android, iOS). Ionic Framework (Cordova + angulasJS + Ionic ) is a great productivity tool which is being used increasingly.

I think it would be a great idea to implement the corresponding Cordova module for the client side for hybrid apps. (Initially I think it would not be necessary to write further code in the server side)

Keep going!
Hi!!!!

I have developed a plugin for Phonega - Cordova. IN this moment I have only developed for IOS and Android, but I hope that in one or two weeks I can have a version to WP

https://github.com/salvatejero/cordova-liferay-plugin
Great job Bruno!

One of the most interesting features is where you mention that "you can update the content on your apps or update its local database as change happen".

This is a game-changer feature!

Congrats!
Hi Bruno, really really interesting!!! Push notification services can be mixed or integrated with portal notifications (notification-portlet)? (e.g. the same message can appear on Liferay portal through notification portlet and user device through push notification portlet)
That's the idea, Dennis!

The Alerts app will become the official app for receiving those notifications. Email me if you want more details or discuss about it, there are some limitations we need to fix first.
This is great stuff. One question: Once a person registers a device, will we be able to push to individuals, and even specify to which devices for that individual, or will it only be to 1) General 2) Sites 3) Roles 4) User Groups?
Hi Amin,

You can pass an array of userIds, which can be provided by role and user group services.

We have built the framework, we still need to integrate that with user notifications, as Denis asked for.
Can you check documentation link ? Please
Documentation was moved to:

https://github.com/liferay/liferay-mobile-sdk/tree/master/push

Thanks for pointing it out, Mirian.
I added in liferay-plugin-packege.properties:
required-deployment-contexts=\
push-notifications-portlet

but in my plugin i can't manage :
PushNotificationsDeviceLocalServiceUtil

i also added push-notifications-portlet-service.jar in WEB-INF/lib but there is not PushNotificationsDeviceLocalServiceUtil
Where is my mistake?
Thank you
Bruno:
Very nice work, and, the API couldn't be easier. However, the key to this, obviously, is tying this in with the existing Notifications portlet, where each item there would have the added "Mobile" checkbox beside the "Website" and "Mail" checkbox. I'm sure this is probably on someone's target at LR right now (i.e. to customize the blogs/bookmarks/contacts/documents/messageboards etc portlets to call this API. Not wanting to waste effort, when do you think this will be available in CE? Or, is it already in EE?

Thanks again!
Hi Bruno!!

Can this plugin be configured with anyLiferay Out of Box features such as : AUI Calendar, Web Contents etc?
Hi Bruno,
Your plugin, Liferay Push Notification use Google Cloud Messaging, but recently Google replaced GCM with firebase cloud messaging. Could you please tell me if your push plugin supports FCM or if there is any solution on how to make it work with FCM?

Thank you,
Augustin Galea
augustin.galea@red-to-blue.com
Hi Augustin,

It doesn't support FCM yet, we have plans to add it.

You can plugin new push notifications services into the push notifications portlet. See the one for GCM, for example:

https://github.com/liferay/liferay-plugins/blob/6.2.x/portlets/push-notifications-portlet/docroot/WEB-INF/src/com/liferay/pushnotifications/sender/android/AndroidPushNotificationsSender.java

A new implementation can be injected via Spring:

https://github.com/liferay/liferay-plugins/blob/6.2.x/portlets/push-notifications-portlet/docroot/WEB-INF/src/META-INF/push-notifications-spring.xml
Hi Bruno, to inject a new plugin we necessary have to clone the repository, modify it and add the new implementation. Is there an alternative way to get the same result without modify the Push Portlet source code? (e.g. writing an OSGI bundle/service?)
Hi Denis, yes, in 7.0 senders are available as separate bundles:

https://github.com/liferay/liferay-portal/tree/master/modules/apps/push-notifications/push-notifications-sender

https://github.com/liferay/liferay-portal/blob/master/modules/apps/push-notifications/push-notifications-sender/push-notifications-sender-android/src/main/java/com/liferay/push/notifications/sender/android/internal/AndroidPushNotificationsSender.java#L54
Do you actually have to implement any changes? According to Google's GCM FAQ there is no difference in the server implementation?!

Hi Bruno ,

 

 i have a question about if the plugin  doesn't support FCM yet or did u make a change ? 

Omar, the plugin does support Firebase. See:

 

https://github.com/liferay/liferay-portal/tree/65059440dfaf2b8b365a20f99e83e4cdb15478aa/modules/apps/push-notifications/push-notifications-sender/push-notifications-sender-firebase

I have installed liferay CE push and configured it to use firebase push notification to work with android test app ..in the beginning it was working perfectly but when i changed the account of the  firebase project and used  the new Legacy server key it didn't work ..registering devices is working fine  but when sending push notifications to the device  nothing is sent andi get an error in the server log   ERROR [liferay/push_notification_response-1][PushNotificationsResponseMessageListener:41] {"payload":null,"javaClass":"com.liferay.push.notifications.sender.BaseResponse","id":null,"platform":"android","status":"HTTP Status Code: 400(Error=DeprecatedEndpoint)","succeeded":false,"token":null} iam using  Liferay Community Edition Portal 7.1.2 CE GA3 and the Liferay CE Push i downloaded from marketplace and it supports  Liferay CE Portal 7.1 GA1+please advise