Configuring Heartbeat Monitor for Android
This topic describes how Pivotal Cloud Foundry (PCF) operators can configure the Push Notification Heartbeat Monitor app for Android.
Heartbeat Monitor is a Cloud Foundry app deployed by the PCF Push Notification service to help you ensure the service runs correctly end-to-end. It does this by sending a push, or heartbeat, every minute to the devices registered with the app. You can also select the app in the Push dashboard to view its historical data.
Follow the instructions below to configure Heartbeat Monitor and run the companion Android app on your device.
The procedures in this document require the following:
- You must have access to a PCF environment with the Push Notification Service installed.
- You must have Android Studio 2.2 or later installed on your machine.
- You must have the Google Repository from the Android SDK Manager.
- You must have the Push Android SDK 1.7 or later from Github.
- The devices that you want to send push notifications to must run Android 2.3 (Gingerbread) or later.
- The devices that you want to send push notifications to must have Google Play Services 9.8.0 or later.
Follow these steps to prepare an FCM project for your app.
- Navigate to the Firebase Console and create an account if you do not have one already.
- Once logged in, Create a project for the Heartbeat Monitor.
- When prompted, click Add Firebase to your Android app.
- For Package name, enter
- Ensure the Debug signing certificate SHA-1 matches the SHA-1 from your debug signing certificate. For instructions on how to get this fingerprint, refer to Authenticating Your Client in the Google APIs for Android documentation.
- After you finish creating or importing your project, a
google-services.jsonfile downloads. Keep track of this file for later use.
- Click your project.
- Click the settings icon next to your project name and select Project Settings.
- Select the Cloud Messaging tab.
- Record the Server key for later use.
Follow these steps to navigate to the Push dashboard and then configure the service to talk to your device.
You can navigate to the Push dashboard using either Apps Manager or the Cloud Foundry Command Line Interface (cf CLI). Use the cf CLI instructions if you did not enable the Push Apps Manager errand when deploying Elastic Runtime.
Navigate to Push Dashboard using Apps Manager
In a browser, navigate to
Select the system org and the push-notifications space.
Click the Services tab.
Select the PCF Push Notification Service row and click the Manage link.
Navigate to Push Dashboard using cf CLI
Open a terminal window and log in:
$ cf login -a https://api.YOUR-SYSTEM-DOMAIN -u USERNAME -p PASSWORD
Target the correct org and space:
$ cf target -o system -s push-notifications
Run the following command:
$ cf service push-service-instance
Copy the URL from the Dashboard field and paste it into your browser.
Configure the Push Notification Service
- Select the Heartbeat App from the list of applications.
- Select the Configuration pane.
- Under the Platforms section, in the Heartbeat Android Platform over FCM row, click the pencil icon to edit the record.
- In the Google Key field, paste the server key that you recorded earlier.
Follow these steps to compile and run the app on your Android device.
- Navigate to the Push Android Heartbeat Monitor repository.
- Clone the repository to your workspace.
- Checkout the
release-v1.7.0branch, or the branch of a later version.
- Copy the
google-services.jsonfile from earlier into the
appdirectory of the Heartbeat Monitor project.
- Open a project in Android Studio using the repo you cloned.
pivotal.propertiesfile located in
pivotal.push.platformUuid: This value must match the platform UUID of the Android FCM Heartbeat Platform in the Push dashboard.
pivotal.push.platformSecret: This value must match the platform SECRET of the Android Heartbeat FCM Platform in the Push dashboard.
pivotal.push.serviceUrl: Enter the server address to your push backend API in the form of
- Compile and deploy the application to your Android device.
Note: To verify that your device registered, see the Devices tab in the Push dashboard. The device Type field displays a Firebase logo.
- Open the app on your device and select Allow when the app asks if it can send you notifications.
The screen updates with a new heartbeat count every minute as it receives pushes from your environment.
Note: If you send a test push to your device from the Push dashboard, ensure the app is not open on your device. You cannot see the test push while the app is open.