Android PingOne Mobile SDK API


Overview

The PingOne Mobile SDK provides the ability to integrate PingOne MFA functionality into your mobile applications.

The PingOne Mobile SDK API for Android is included in the SDK package. The functions, parameters and error codes are listed below.

Further details on how to integrate PingOne Mobile SDK into your Android applications are provided in the mobile SDK package. Download the mobile SDK package from https://github.com/pingidentity/pingone-customers-mobile-sdk.

PingOne Mobile SDK API - Android

PingOne main public class

/**
* Created by Ping Identity
* Copyright © 2019 Ping Identity. All rights reserved.
* Version 1.0
*
* Main public class that contains APIs
*/
public class PingOne {

	/**
	* Callback interface that will notify developers about task completion
	* PingOneSDKError object will be null if process completed successfully
	*/
	public interface PingOneSDKCallback {
	   void onComplete(@Nullable PingOneSDKError error);
	}
	/**
	* Callback interface that will notify developers about processRemoteNotification task completion
	*  NotificationObject will be returned if process completed successfully
	*  PingOneSDKError object will be null if process completed successfully
	*/
	public interface PingOneNotificationCallback {
	   void onComplete(@Nullable NotificationObject notificationObject, @Nullable PingOneSDKError error);
	}
	
	/**
	* Pairs the device with the PingOne server using the pairing key
	* @param context   application context
	* @param pairingKey    pairing key as a String
	* @param callback  notifies a completion
	**/
	public static void pair(Context context, String pairingKey, PingOneSDKCallback callback)
	
	/**
	* Set device’s remote notification token.
	* @param context an application context
	* @param fcmRegistrationIdToken the registration token retrieved from FCM
	* @param callback notifies a completion
	*/
	public static void setDeviceToken(Context context, String fcmRegistrationIdToken, PingOneSDKCallback callback)
	
	/**
	* Process the remote notification received from PingOne
	* @param remoteMessage a remote message retrieved from FCM
	* @param callback PingOneNotificationCallback notifies about task completion. Will return
	* NotificationObject if process completed successfully, or PingOneSDKError if unsuccessful
	*/
	public static void processRemoteNotification(RemoteMessage remoteMessage, PingOneNotificationCallback callback)

Notification Object

/**
* Created by Ping Identity
* Copyright © 2019 Ping Identity. All rights reserved.
* Version 1.0
*
* NotificationObject represents an authentication request via remote notification.
* It can be approved or denied.
* Implements Parcelable so the developer will be able to pass it via intents in application
*/
public class NotificationObject implements Parcelable{
	
	/**
	* Approve authentication
	* @param context application context
	* @param callback a callback notifies a completion
	*/
	public void approve(Context context, final PingOneSDKCallback callback) 
	
	/**
	* Denies authentication
	* @param context application context
	* @param callback a callback notifies a completion
	*/
	public void deny(Context context, final PingOneSDKCallback callback)
}

PingOneSDKError

/**
* Class that describes an error by error code and error message
*/
public class PingOneSDKError {
	public int getCode()
	public String getMessage()
}

PingOne Mobile SDK API error codes

Error Status Description
10000 INTERNAL_ERROR Internal Error
10001 DEVICE_TOKEN_IS_MISSING Device token was missing and is required to complete this action
10002 UNRECOGNIZED_REMOTE_NOTIFICATION Remote notification isn’t from PingOne
10003 SERVER_ERROR There was a server error
10004 NO_CONNECTIVITY There was a problem with the network
10005 PAIRING_KEY There was a problem with the pairing key
10006 BUNDLE_ID There was a problem with the application ID