Version: 4.6.0

Resources

Getting Started

You’ll find a sample app using the PingOne Fraud for Android SDK

To integrate the PingOne Fraud for Android SDK on your client:

  1. Add the mavenCentral repository to your root build.gradle file:

    allprojects {
         repositories {
             mavenCentral()
         }
     }
  2. Add the PingOne Fraud for Android SDK to your application dependencies.

  3. Add the following to your application-level build.gradle file:

    implementation "com.pingidentity.pingonefraud:android-sdk:${LATEST_VERSION}"
  4. Initialize the SDK. Extend the Application class and add the following inside the onCreate method:

    public class MyApplication extends Application {
    
     @Override
     public <span class="hljs-keyword">void</span> onCreate() {
         <span class="hljs-keyword">super</span>.onCreate();
    
         <span class="hljs-comment">// optional</span>
         SecuredTouchSDK.setEventListener(<span class="hljs-keyword">new</span> StatusEventListener() {
             @Override
             public <span class="hljs-keyword">void</span> onError(@NonNull <span class="hljs-built_in">String</span> uuid, @NonNull <span class="hljs-built_in">String</span> message, int code) {
                 Log.i(<span class="hljs-string">"SecuredTouchSDK"</span>, <span class="hljs-string">"onError "</span> + message + <span class="hljs-string">" code: "</span> + code + <span class="hljs-string">" uuid: "</span> + uuid);
             }
    
             @Override
             public <span class="hljs-keyword">void</span> onInitialized(@NonNull <span class="hljs-built_in">String</span> uuid) {
                 Log.i(<span class="hljs-string">"SecuredTouchSDK "</span>, <span class="hljs-string">"onInitialized "</span> + uuid);
             }
         });
    
         STInitParams initParams = <span class="hljs-keyword">new</span> STInitParams(&lt;appId&gt;, &lt;appSecret&gt;, &lt;serverHost&gt;)
             .setUserId(&lt;currentUserId&gt;)
             .setSessionId(&lt;sessionId&gt;)
             .setDebugMode(BuildConfig.DEBUG)
             .setConsoleLogEnabled(BuildConfig.DEBUG);
    
         SecuredTouchSDK.init(this, initParams);
     }
    

    }

    Parameter Description
    appId The PingOne application ID. See the PingOne Fraud admin documentation for instructions on getting the PingOne Fraud SDK access credentials.
    appSecret The PingOne application secret. See the PingOne Fraud admin documentation for instructions on getting the PingOne Fraud SDK access credentials.
    serverHost The Fraud service host. See the PingOne Fraud admin documentation for instructions on getting this information.
    userId If the user is already identified (signed on) when initializing the Fraud SDK, their user ID should be set here. If the user ID originates from PingOne, use the user ID for the PingOne environment. For all other cases, use a non-personal user identifier.
    sessionId The user’s session ID. To query the Fraud service for the trust scores through the backend system, the Fraud service and the backend system must have a shared identifier for each session. The session ID usually serves as this shared identifier.
    consoleLogEnabled (Optional) Set this to true to enable console logging by the SDK. Defaults to false.
    externalLogsEnabled (Optional) Set this to false to prevent the SDK from sending error logs to an external logging service. Defaults to true.
  1. Set an event listener to get calls on successful SDK initialization, or for when something goes wrong in the SDK.

    Parameter Description
    uuid Unique identifier for the entire lifetime of the SDK. This value stays the same as long as the app’s process is alive. Also available through SecuredTouchSDK.getInstanceUUID();.
    message The nature of the failure.
    code Internal error code.
  2. Fetch a Fraud token. The SDK generates a token that’s used for Fraud BOT detection capabilities. You’ll need to share the token with your application backend so a call with the fetched token can be sent from this backend to the Fraud Evaluation API to retrieve the risk assessment for a session.

    To get the token from the Fraud SDK, add a call to:

    SecuredTouchSDK.getToken();

    An event is fired every time the token changes. For example:

    SecuredTouchSDK.setTokenReadyListener(new TokenReadyListener() {
       @Override
       public void onTokenReady() {
         Log.i("com.securedtouch", "token ready: " + SecuredTouchSDK.getToken());
       }
     });

    Don’t use your application to store the token, and instead share the token stored by the SDK.

  3. User log in and log out. You can do this differently, depending on the following:

  4. Set the session ID. To query the Fraud service for the trust scores through the backend system, the Fraud service and the backend system must have a shared identifier for each session. The session ID usually serves as this shared identifier. To set the session ID after the application has it, call:

    SecuredTouchSDK.setSessionId(<session-id>);
  5. Add meaningful IDs to input fields and buttons. Meaningful IDs are required to ensure proper identification of the UI element for detection purposes. Here’s an example for a meaningful ID that can be added to a Login button:

    android:id="@+id/button_login"
  6. Add tags. You can tag specific points in time during a session that will be saved by the Fraud service. Tags can be added remotely by the PingOne Fraud platform (using CSS selectors), or programmatically using JavaScript or HTML attributes.

  7. Flush the buffer. Flushing the buffer forces the SDK to send buffered data to directly to the PingOne Fraud backend platform. Usually the built-in automatic flush should be sufficient, so this function should not be used unless instructed to do so by Ping Identity Professional Services.

    SecuredTouchSDK.flush();

Useful operations

Context APIs

PingOne Fraud does not collect email addresses or phone numbers, but their anonymized features instead (such as, email domain, length, phone number, and country code).

Login page

Registration page

Account page

Checkout page

Product page

Catalog page

Challenge page

Cart page

Orders page

Chat page

Feed page

Feedback page