Orchestration SDKs

Testing push notifications on Android

PingOne Android

Before testing push authentication end-to-end, you can confirm that PingOne can reach your app through Firebase Cloud Messaging.

This step needs everything in Configuring push notifications and the token registration code in Handling push notifications to be in place first.

Your app must be running with a valid google-services.json so that Firebase issues a push token, and the app must register that token with PingOne using setDeviceToken.

Getting the push token from your Android app

The example token registration snippet in Handling push notifications includes a commented-out log message that prints the token after a successful registration.

Add similar code to your own app, run it, and copy the token from Logcat:

Registered. FCM push token: fK4xgQm2RbVt7Nw9Zp1eH_:APA91bHq-...

If the app was already installed before you completed the FCM configuration, onNewToken might not fire again on startup. Uninstall and reinstall the app, or read the current token directly, for example:

Reading the current FCM token
FirebaseMessaging.getInstance().token.addOnSuccessListener { token ->
    Log.d("FCM", "Push token: $token")
}

An FCM token is a long, alphanumeric string, that resembles the following:

Example FCM Push token from an Android application
fK4xgQm2RbVt7Nw9Zp1eH_:APA91bHq-3TzWvKdY8mBn5rQcX2fLpA0sUeJ6gVhN1kRi7MwD4yOaZt9CbXfEh3Gj5Kl8Mn0Pq2Rs4Tu6Vw8Xy0Zb2Cd4Ef6Gh8Ij0Kl2Mn4Op6Qr8St0Uv2Wx4Yz6Aa8Bc0De2Fg4Hi6Jk8Lm0Np2Qr4Ss6Tt8Uu0Vv2Wx4Yz6Za8Bb0Cc2Dd4Ee6Ff

Sending the test push

To send a test push notification from the PingOne admin console:

  1. Log in to your PingOne administration console.

  2. In the left panel, navigate to Applications > Applications.

  3. Select the Native App (OpenID Connect) application that represents your mobile app, for example pingone-mfa-android.

  4. On the Mobile tab, click the pencil icon ()

    The page displays the date when you uploaded the Firebase Admin SDK Private key file:

    pingone push notification test
    Figure 1. The Mobile tab of a PingOne native application, showing the Test button.
  5. Click Test.

    PingOne displays the Test Push Notification dialog:

    pingone push notification test dialog
    Figure 2. The Test Push Notification dialog.
  6. In Registration Token for Google Play Services, paste the push token you copied from Logcat.

  7. Click Send Test.

The device receives a notification if PingOne can reach the app through FCM:

pingone dry push notification
Figure 3. Test push notification on an Android device.

A successful test confirms that the service account key is correct and that PingOne can deliver to your app. If the test fails, check that the key came from the same Firebase project as your google-services.json.

If push notifications do not arrive after everything is configured, check that both files came from the same Firebase project and that the key was uploaded after the FCM push credential was created for the correct application in PingOne.