As all we know that Parse is shutdown we need move to another backend website for Android Push Notifications. One such alternative is also allow you to send Images as notifications and also give you clear statistics about your notifications. And Implementing Push notifications in Android App is a cake Job.

Prerequisites for Implementing Push Notifications in Your Android App.

  1. Android Studio Project
  2. GCM Project ID and Server Api Key ( Watch This Video to know how get GCM Credentials )
  3. Account (Signup Here Its free)

Watch below video for good understanding.



Procedure Include 2 Parts 1. Android Side 2. video)

  1. Android Side
  • Open your Android Studio project in which you want to add push Notifications.
  • In project structure go to app and open build.gradle and add below lines in your dependencies
compile ''
compile ''
compile ''
compile ''
compile 'com.onesignal:OneSignal:2.+@aar'
compile ''
compile ''
  • Then add below lines to you defaultconfig in build.gradle below the versionName.
manifestPlaceholders = [manifestApplicationId: "${applicationId}",
                        onesignal_app_id: "OneSignal App ID",
                        onesignal_google_project_number: "GCM Project ID"]
  • Now replace OneSignal App ID  in above code with One Signal App ID (Watch video above to know how to get ID)
  • Also replace GCM Project ID with you ID (Watch This Video to know how get GCM Project ID)
  • Then Open Your Main  and add below lines of  under onCreate method below super.onCreate();
        .setNotificationOpenedHandler(new ExampleNotificationOpenedHandler())
  • Then add below method to your file
// This fires when a notification is opened by tapping on it or one is received while the app is running.
private class ExampleNotificationOpenedHandler implements OneSignal.NotificationOpenedHandler {
    public void notificationOpened(String message, JSONObject additionalData, boolean isActive) {
        try {
            if (additionalData != null) {
                if (additionalData.has("actionSelected"))
                    Log.d("OneSignalExample", "OneSignal notification button with id " + additionalData.getString("actionSelected") + " pressed");

                Log.d("OneSignalExample", "Full additionalData:\n" + additionalData.toString());
        } catch (Throwable t) {
  • Then rebuild the Project and make sure it rebuilds the project without any errors.