Google Code Jam 2016 ( Qualifying Round )

Filed under:
I have cleared the qualifying round of Google Code Jam (2016) once again and hope to do better than previous years in Round 1. I wanted to do the same live-stream blog sort of thing I used to do every year but couldn't find time for it.

According the Google Code Jam statistics website, maintained by Ahmed Aly, 178/259 participants have qualified from Pakistan. I am ranked 48 in Pakistan and 10269 overall out of 27170 participants. Below is the screenshot from Ahmed's website.

The day after #PanamaLeaks

Filed under:
9:00 AM: Came to office a bit early today to try out the repaired elliptical trainer and the cycling machine in the gym. The jerky motion of elliptical trainer while pedaling was now gone and it was working smoothly, though I still thought the machine itself is a bit unbalance from the top left side. I still couldn't find the weight machine that Junaid told us in the email that it is placed in the gym. I'll ask him about it later. I'll get the 2 AA batteries for the machine in the lunch break as well.  

10:15 AM: My team still hasn't come yet. The project is still in the maintenance phase, and there is no major work for the team, that is why most of the team comes late. We are gathering requirements and researching on third-party libraries for future tasks. I have to complete one associated links work but the design is still not approved by the client, that is why I am on hold on that task as well. If there is no more task for me today, I'll probably start integrating unit test in the project for my learning.

Push Notifications with Parse (Part Two)

Filed under:

PART 2: Receiving Parse Push Notifications on Android



This is a three-part tutorial series that will demonstrate how to send Parse’s Push Notifications from the backend server to the client devices (Android & IPhone). In the first part, a REST based backend server was built with Java EE Spring4 and Jersey framework that utilizes Parse’s Rest APIs to send Push Notifications. 

This is the second part of the series, and in this part we will build an Android client using Android Studio IDE targeting Android Honeycomb (API SDK Level 11) and Lollipop (API SDK Level 22) that will receive push notifications sent by the backend server. 


The following software have been used to implement this tutorial.
  1. Java SDK 1.7+ (Version 8 update 65)
  2. Android Studio (Version 1.4)

Receiving Push Notifications on Android Client

Step 1 Creating A Blank Project

Parse provides a starter project built using the gradle dependency system to quickly jump start a project for push notifications. For that, head over to You will be presented with the following screen. Click on the “Push” icon.

      After that, you will be asked to provide an environment. Click on the “Android” icon. 

   Then, on the next screen click “Native (Java)” project.

 Then, click “New Project”.

      At this point, Parse starter project would be configured for you. We will just download it on our computer. Click on “Download the blank Android Project”.

Step 2 Importing the Project in Android Studio 

      Next, we will extract this project”, and import in in Android Studio. Click on File -> New -> Import Project … I have extracted the zip file in “F3-Parse-Android” folder and imported in the Android Studio.

    Then, select your extracted folder and import it. The gradle dependency system will download all the dependencies of the project. Once the dependencies have been downloaded, you can refactor the “ParseStarterProject” project. I have refactored it to “F3Scrum”. I have also refactored the package name from “com.parse.starter” to “com.folio3.parse”.

      Once all the dependencies have been downloaded, it should look like below.

Step 3 Connecting Android Application with Parse

      We will extract the Parse Application ID and Parse Client Key from Parse and enter it in our strings.xml file.

      Then we will add “service” and “broadcast” receiver definitions in AndroidManifest.xml file. The android:name attribute of <category> element should match the application's package name.

      We will also add the permissions that our application needs to connect with Parse.

Step 4 Creating an Activity and Layout

      Now we are going to modify file to log Parse push notifications in an internal storage file “push_log.txt”. Whenever a notification is received an clicked will be triggered. 


      The corresponding layout file for MainActivity is activity_main.xml file defined in onCreate method. The layout file contains a TextView that will act as a header with the text “Push Notifications Log”, and a PushFragment which will read the internal storage file and display it in a list form. 






    Finally, we are going to modify and subscribe our installation object to “channelOne” channel so that whenever a push notification is generated for this channel, we are going to receive it.

Step 5 Configuring the Gradle build file

      In this step we are going to configure the gradle dependency system to our requirements. I’ll change the minimum SDK version to 11, compile SDK version to 22 and buildToolsVersion to 22.0.1. As of 1st November 2015, Parse Library doesn’t support version 23 (Marshmallow) of Android SDK (

     The main project build.gradle file would look like as follows.

      The build.gradle file of the module “F3Scrum” would be changed to reflect our refactored application package “com.folio3.parse”. 

Step 6 Testing the Application

      Next, we are going to test our application. Go to Run -> Run ‘F3Scrum’ to run the application. It will ask you to specify an emulator or an android device (if connected to the computer) to deploy the application.

    Once the application is deployed, an empty screen with the header “Push Notification Log” and an empty list view. 

     Now we are going to start our backend server (built in part 1 of the tutorial) and send sample message via Postman. 

     “Starting up the server”

     “Sending sample message”

     “Server log of message processing”

      Once the message is sent from the server, we should receive a push notification in our Android application shortly. 

      When you click on the message, it will launch the Main Activity and the message will be logged in the list view.


      In this tutorial, we created an android application that receives push notifications from the Parse server on a subscribed channel. We used our backend server to send push notifications to a channel and received those notifications in our application. In the third part, we will create a similar application on IPhone to receive push notifications. 

About me

I'm a chocoholic, Kitkat please.

Shahab Hameed is a MS (Computer Science) student lead software engineer, blogger, geek, living in Lahore Karachi, Pakistan. He likes music, sleeps too much, plays counter strike [nickname: cOOkie mOnster], loves to sit in front of his computer and has an unhealthy addiction to smileys. He got married on 23rd September 2016 and was blessed with a daughter on 28 November 2017. He is currently studying Artificial Intelligence (Computer Vision) from LUMS university employed by Folio3 Pvt. Ltd where he works on a Magento eCommerce platform project.

He dreams of someday living somewhere warm and learning guitar.

Thanks for stopping by.


oDesk Certified Google Android Developer

oDesk Certified PHP5 Developer

oDesk Certified English Spelling Professional

oDesk Certified English (Sentence Structure) Test

oDesk Certified oDesk Professional