Implementing GCM in your Android application already has great tutorials out there so I wont go reinventing the wheel. Our team used Google’s GCM documentation, and as the mobile developer responsible for the client side implementation I followed the Implementing GCM Client guide.
Lets start from where you’ve already implemented a push notification system, and your Android application can receive data from your server via GCM. This article is about adding some icing to that delicious cake of yours, by offering an alternative behavior and some features to those posted notifications.
Push Notification System Requirements
To add some context our requirements were. On clicking the delivered notification in the users notification area. If the application was in the:
Background – Bring the application to the foreground opening the applications first activity (commonly know as the MainActivity) displaying a popup containing the notifications full message.
Foreground – Opens the applications current activity displaying a popup containing the notifications full message.
After some research I came across a question on Stack Overflow that both asked and answered how to implement what I required. The answer was to use pending intents. My addition to that answer is that this pending intent should contain multiple intents. Now lets see exactly how to do it.
Shortly after joining Red Stallion Gaming, a video game publisher in Bahrain. I started developing their Android mobile application.
When I got my hands the app it was setup to communicate with a Web API, could only perform simple login and game download. There was plenty of work to do, and my efforts in this project were most notably:
Redesigning a new look and feel for the app.
Improving the login feature, as well as adding social media integration’s, for sign in and sign up.
Adding purchasing functionality with payment methods such as PayPal and Red Stallion Gaming virtual currency.
Adding a SQLite database for persistent storage to significantly reduce the data requests to the server, and improve the users experience.
Adding Wishlist, Library, Forgot Password and Search features.
Adding basic DRM measures.
Implementing a procedure, with built in token refreshing, of communicating with the existing API and a newly developed API to collect data for a smooth user experience.
The result of all this work was me completely redesigning, refactoring and implementing the mobile application. It’s been a lot of hours of work, but its finally released!
There’s lots more work to do on it, and in the mobile side of the company, but I’m happy to say that we’ve taken our first step.