Extend an Android app using the IBM Push Notifications service on Bluemix

Use Push notifications to send relevant content to mobile devices

03 May 2016
PDF (884 KB)
Share:
author photo - belinda vennam

Belinda Vennam

Software Engineer, IBM Mobile Cloud Services

dW Connections

author photo - Salim Zeitouni

Salim Zeitouni

Software Engineer, IBM Application and Integration Middleware

dW Connections

Paul Mariduena

Paul Mariduena

Software Engineer, IBM Application and Integration Middleware

dW Connections

author photo

Chris Shen

Product Manager, IBM Bluemix Dev. Advocate

LinkedIn

Editor's note: This tutorial is an update to "Extend an Android app using the IBM Push for Bluemix cloud service" originally published in February 2014. It was written using the Bluemix classic interface. Given the rapid evolution of technology, some steps and illustrations may have changed.

You may already know about some of the benefits of Bluemix™, IBM's open platform for developing and deploying mobile and web applications. The many pre-built services in the mobile solutions in Bluemix make it easy to build and enhance applications.

In this tutorial, we'll extend an existing Android application using the Push Notifications service on Bluemix.

READ:Getting started with Push

As introduced in the previous tutorial in this series, the BlueList application is a simple Android app. In this tutorial, we'll add the Push Notifications (invoked from a Node.js-hosted application) to the BlueList app, so that notifications are sent when a list is updated, and the list is updated on all devices when one of the devices updates the list in some way.

With the free services on Bluemix, you can get started writing and extending your own applications in no time!

Note: The sample code has been deprecated and is no longer supported.

What you'll need

 

Step 1. Open the mobile app

 

Log in to Bluemix and open the BlueList app you built in the previous tutorial.

Screen capture of the BlueList application built from the previous tutorial

Click to see larger image

Step 2. Run the mobile app to make sure it still works

 
  1. Open the app in Android Studio and build it.
  2. Run the app on your Android device or simulator.
  3. Add some items to the To Do List of your app. Remember to sync your list with the database on the cloud by pulling down the screen.
Screen capture of the BlueList application on a mobile device

Step 3. Check your data on the cloud

 

In Bluemix, select the Cloudant NoSQL DB service and click the Launch button to open the Cloudant dashboard.

Screen capture of the Clouding NoSQL DB service page

Go to the todosdb database.

Screen capture of todos database showing the number of items synced to the database

The items are already synced to the database.

Screen capture showing your Google API Project number and Google Cloud Message API Key

Step 4. Add and enable the Push Notification

 

Get your Google API Project number and Google Cloud Message API Key.

READ:Configuring credentials for Google cloud messaging (GCM)

Screen capture of the API credentials

Copy the API key you just created and the Google Project number (Sender ID) into the Push Notifications configuration dashboard.

Screen capture of the Push Notifications configuration dashboard

Step 5. Test sending notifications from Bluemix

 
  1. Log in to Bluemix.
  2. From the Dashboard view, click your application.
  3. Click the Push service icon.
  4. Click the Notification tab.
  5. Choose the audience and fill in the Message text field with anything you want. Screen capture of the audience and text message fields
  6. Click SEND.
  7. Watch as your mobile device or emulator receives a push notification! Screen capture of notification message on a device

Conclusion

 

Extending your app using the Push service available in Bluemix should give you a sense of how easy it is to consume and integrate mobile data capabilities using Mobile services in Bluemix. So far in this series, you've used the Cloudant NoSQL DB service to store, delete, update, and query a list of objects stored on the cloud. You've also used the IBM Push Notifications service to refresh the list on all devices and send notifications when one of the devices updates the list in some way.


BLUEMIX SERVICE USED IN THIS TUTORIAL:The IBM Push Notifications service helps to send push notifications to Android and iOS devices.

RELATED TOPICS:AndroidNode.js

Add a comment

Note: HTML elements are not supported within comments.


1000 characters left

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Mobile development, Cloud computing
ArticleID=963626
ArticleTitle=Extend an Android app using the IBM Push Notifications service on Bluemix
publish-date=05032016