Skip to main content
Skip table of contents

Push Notification for Android Phone

Overview

This section documents the creation of a Google API project and installation/configuration of the RPI Android Push Notification Demo App.

PC Pre-requisites

  1. AndroidSDK: The Android SDK provides the API libraries and developer tools necessary to build, test, and debug apps for Android (http://developer.android.com/sdk/index.html)

  2. Latest version of the Android Studio (https://developer.android.com/studio/index.html)

  3. Java Development Kit(JDK) (http://www.oracle.com/technetwork/java/javase/downloads/index.html)

Push Notification Client App Deployment

The following steps describe how to deploy the RPI Android Push Notification Demo App.

  1. Ensure that an Android phone is connected to your PC.

  2. Obtain a copy of the AndroidPushNotification source code. Make sure that no files are read-only. You can find the project on Humboldt by browsing TFS path:
    $/Resonance/MobileClient/_Master/AndroidPushNotification_AndroidStudio

  3. Open the Android Studio.

image-20250909-182743.png
  1. Click ‘Open an existing Android Studio project’ and browse the copy of the AndroidPushNotification source code then click OK.

image-20250909-182821.png
  1. Once the android project is loaded, click Build > Build APK.

image-20250909-182853.png
  1. Click Event log.

image-20250909-182932.png
  1. Once the build is completed you can browse the apk by clicking the ‘Show in Explorer’ link.

image-20250909-182953.png
  1. Copy and install the apk file into your device.

Creating and Setting up a Google API project

This section creates a Google API project and configures Google Cloud Messaging for Android devices for push notification.

After completing these steps, you should have a Sender ID and an API key, which can be used later to configure the RPI Android Push Notification Demo App and Notification Hub.

To create a Google API project, please follow the steps below:

  1. Open the Google API Manager page (https://console.developers.google.com/apis/). 

  2. Click Create a project. You will be prompted as shown:

image-20250909-183038.png
  1. Enter a Project name. Click Create and you will be redirected to the newly created project:

image-20250909-183103.png
  1. Click Project information.

image-20250909-183127.png
  1. Take note of the Project number (363997629329 in this example) as it will be used later as the Sender ID. Then click OK.

image-20250909-183218.png

Enabling the Google Cloud Messaging (GCM) Service

To enable the GCM service, please follow the steps below:

  1. In the Google API Manager page, select the previously created project (PushNotificationDemo in the worked example).

  2. On the overview page, search for ‘Google Cloud Messaging’.

image-20250909-183259.png
  1. Select ‘Google Cloud Messaging’, then click Enable button.

image-20250909-183318.png

Obtaining an API Key

  1. To obtain an API key, in the Google API Manager page, select the previously created project (PushNotificationDemo in the worked example).

  2. Click Credentials then Create credentials.

image-20250909-183439.png
  1. Create credentials using ‘API key’.

image-20250909-183458.png
  1. Select server key.

    image-20250909-183537.png
  2. Enter a name for the server key and click Create.

image-20250909-183559.png
  1. Your new API key will be shown in a prompt. Use this as the GCM key to configure the Windows Azure Notification Hub.

image-20250909-183623.png

Android Phone Configuration

Configuration of the RPI Android Push Notification Demo App assumes successful prior configuration of the Windows Azure Notification Hub.

Please follow these steps:

  1. Open the installed RPI Android Push Notification Demo App.

  2. Configure properties as follows:

    • Set Sender ID to the Project Number recorded when creating the Google API Project.

    • Provide the Notification Hub name.

    • Set the Hub connection string.

  3. Click Subscribe to register the application for Push notifications.

  4. Click Unsubscribe to opt out of the receipt of messages from the Notification Hub.

image-20250909-183827.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.