Android App Development / Mobile App Development / Mobile App Framework

How Android App push Notification works

Just Total Tech
06 Dec 2018

Push Notification allows an application to notify the app user of new messages or events without the need to actually open the application. Push notification works as constant open IP connection to forward notification from the servers of third party applications to the mobile devices. Push notification request for a given transaction is managed by the publisher or central server and notification services for mobile are highly efficiently runs in the device background and enables android application to receive the messages to the customer in the most direct and targeted way possible. Contrast to the PULL : where the request for the transmission of information is initiated by the receiver or client.

Key Elements of Push Notification

Trigger

Behavior-Based ? Pre-Defined ? Rule-Driven

User Behavior

Read Only ? Read/Write ? Act-outside-the-App

Content Type

Universal Vs Personalized ? Open vs Protected ? Lean Vs Detailed ? Time Sensitive vs Anytime

Intelligence

BI-Analytics

How Push Notification Process Works

Using Google Cloud Messaging (GCM) sending push notification from web server to registered android devices. How Android App push Notification works

1. Registering for the Push Service

To use push notifications, your application must register the following service and broadcast receivers and add the following XML to your AndroidManifest.xml file immediately before the closing . If you will modify the package name of the app, also change the android name attribute of element above to match your application's package name.

2. Setting Permissions

Next step, your application must have the permissions needed to receive push notifications and show notifications and after that make sure these permissions are present in your AndroidManifest.xml. If you will modify the package name of the app, also change the android:name attribute in the last two lines of the snippet above to match your application's package name.

3. Choose Your Push Icon

If you want push notification to use an app icon that is not your application's icon, add the following XML to your AndroidManifest.xml file immediately before the closing

4. Add your API keys

Create or open an application class and add the following line to onCreate method: initialize(this, "YOUR_APP_ID", "YOUR_CLIENT_KEY"); Make sure to replace "YOUR_APP_ID" and "YOUR_CLIENT_KEY" with your app's id & client key .

5. Enable Push Notifications

Finally, your device needs to register itself for push notification. The simplest way to get started is to subscribe to a particular channel and after that by convention, the channel is called the "broadcast" channel and is used for broadly applicable notification messages. To subscribe to the broadcast channel, use following codes on onCreate method of Application class

6. Send a Test Push Notification

At this step, you're ready to send push notifications. As compared not similar to iOS, Android push notifications do work from the emulator, so developer can use the emulator to test out push notification.

Push Notification Framework

Android App push Notification

Communication Protocol

Connection HTTP Post
Security SSL
Content JSON
Trust Gmail account authentication
“Device not found“ errors Response to POST requests contain indications whether devices is obsolete or not.

Advantage/Disadvantage

Advantages :

Cloud Storage in android push notification presented an extensive characterization both in terms of the system workload as well as the typical usage. Usage of per/chunk acknowledgments in the client protocol combined with the typically small chunk sizes deeply limits the effective throughput of the service. It`s provides real time information update as soon as it is created. Push Notification provides richer sets of meta data and travel over the data network. ? Improves battery saving mode and consumes less CPU cycles.

Disadvantages :

For Cloud storage security is a major issue. We need more work on improving security of personal cloud storage. ? Push Notification is not feasible fit for the cases where data is not required immediately and one can achieve the desired output by using poll mechanism.