Extend an Android app using the IBM Push Notifications service on Bluemix
Use Push notifications to send relevant content to mobile devices
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.
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
- A Bluemix account
- Familiarity with the previous tutorial in this series, where we built an Android application using the Cloudant NoSQL DB services on Bluemix. That app is the starting point for this tutorial.
- Familiarity with Android development
Step 1. Open the mobile app
Log in to Bluemix and open the BlueList app you built in the previous tutorial.
Step 2. Run the mobile app to make sure it still works
- Open the app in Android Studio and build it.
- Run the app on your Android device or simulator.
- 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.
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.
Go to the todosdb database.
The items are already synced to the database.
Step 4. Add and enable the Push Notification
Get your Google API Project number and Google Cloud Message API Key.
Copy the API key you just created and the Google Project number (Sender ID) into the Push Notifications configuration dashboard.
Step 5. Test sending notifications from Bluemix
- Log in to Bluemix.
- From the Dashboard view, click your application.
- Click the Push service icon.
- Click the Notification tab.
- Choose the audience and fill in the Message text field with anything you want.
- Click SEND.
- Watch as your mobile device or emulator receives a push notification!
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.
- Getting started with Push
- The IBM Push Notifications service
- Modernize Java apps with IBM MobileFirst on Bluemix