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 iOS app on your device.

Prerequisites

To configure the Heartbeat Monitor app for iOS, you must have the following:

Create a Profile

Click on the + button in the top right to create a Provisioning Profile.

Choose the iOS App Development type and click Continue.

From the App ID dropdown, select the App ID you created earlier and click Continue.

Select the Developer Certificate(s) that you want to use and click Continue.

Select the Devices that you registered and click Continue.

Provide a descriptive Name for the Provisioning Profile and click Continue.

Click Download and open your Provisioning Profile.

Note: When you open your Provisioning Profile, Xcode installs it without providing any confirmation. In a later step, you configure your Xcode app project to use this Provisioning Profile.

Configure your Push Dashboard

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 apps.YOUR-SYSTEM-DOMAIN.

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 iOS Platform row, click the pencil icon to edit the record.

PASSWORD: Enter the password you used when creating your APNS certificate.

Click Save.

Run the App on Your Device

Follow these steps to open the project for the Heartbeat Monitor iOS app in Xcode and run the app on your device:

Download the App Repo

Clone the Push iOS Heartbeat Monitor repository:

$ git clone git@github.com:cfmobile/push-ios-heartbeatmonitor.git

Run the following command to open the Xcode project:

$ open PCF\ Push\ Heartbeat\ Monitor.xcodeproj/

Configure the App Project

In the Project Navigator, select the Pivotal.plist file.

In the editor, change the value for pivotal.push.serviceUrl to the Push Notification API endpoint for your environment: https://push-api.YOUR-SYSTEM-DOMAIN.

Ensure that the values for the following Root fields in the editor match the corresponding values in the Push dashboard under the Heartbeat iOS Platform record:

Root Field in Editor

Platform Field in Push Dashboard

pivotal.push.platformUuidDevelopment

Platform UUID

pivotal.push.platformSecretDevelopment

Platform Secret

Under the General tab, set the Provisioning Profile dropdowns to the profile you created earlier.

Note: Do not select the checkbox to automatically manage signing.

Under the Capabilities tab, ensure that both Steps are enabled for Push Notifications.

If your PCF deployment does not use an SSL certificate signed by a Certificate Authority (CA), add an exception domain to the info.plist file by selecting App Transport Security Settings > Exception Domains and entering push-api.YOUR-SYSTEM-DOMAIN.

Build and Run the App

At the top of the Xcode window, select the device icon and choose your device.

Click the play button to build and run the app on your device.

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.