Apr24

Android zu Android Push-Benachrichtigungen

Sonntag, 24 April 2016 Escrit per Marc Farssac Categories Mobile App, Google Cloud, 2016, Technologie, Nachrichten

  • Übersetzung: 25%

Bidirectional communication between mobile devices applicable to many problems / products

Android zu Android Push-Benachrichtigungen
Our last development has been for a Mobile Taxi App project. Our customer required a working sample and code of an Android client and the backend needed to communicate distributed mobile devices with each other.
Our prototype counts with an Android client that using OAuth2 validates a user email against the Google servers. We use his name to determine if it has the role of a driver or a passenger (basically, our demo works with emails containing the words driver and passenger to assign the App a user role).

Once the user is loged, the passenger can requests the services of a Taxi Driver and the driver, receives requests from passengers.

The architecture that makes this possible counts with the GCM Google Cloud Messaging Connection Servers who receives messages from our Backend App server and sends them to registered Android clients. Devices register and unregister with our Backend server so that we know all the time who is on the field. Using the XMPP (Extensible Messaging and Presence Protocol) we return information from our devices to the Application server.

The usage of notifications brings a lot of power to the App, since on one side they are collected on the notifications drawer of the device and can be watched by the user any time latter (if for example, it is driving or making a call). On the other side, push notifications use the Google infrastructure and this is an advantage when compared to classical SMS messages since we can use this to implement a bidirectional protocol like the XMPP to receive information from our devices on the same delivery path as soon as they receive the notification. Another adventage of GCM is that the server handles the delivery of messages. This means that if for example a driver is on a tunnel when a message is sent to it, the message will not be lost, but it will be waiting for the driver to have reception again. GCM handles this delivery and makes our life very easy.
We have solved many difficulties on the way. One has been the fact that different Android versions have different behaviours to Notifications. Another one has been to programmatically update the screen with information from the notification before the user saw it.

All in all this is a very nice project. It has OAuth2 user validation. It registers devices with the Google App Engine Mobile backend. It sends notifications from the Google Cloud Messaging Connection Server to the registered devices and receives information from devices on the same way. Pushing notifications from Android devices instead of pushing them directly from a server it is an interesting characteristic of this solution an particular to it. We communicate a passenger and a driver with them, establishing a link between two mobile devices. Such approach is not only valid for Taxi Apps, but is similar to the one that Chat Apps or even WhatsApp use to communicate their users with each other.

Suchen innerhalb der Webseite

Android Apps