Skip to content

Latest commit

 

History

History
99 lines (74 loc) · 2.67 KB

README.md

File metadata and controls

99 lines (74 loc) · 2.67 KB

Attestr Android SDK

Platform GitHub GitHub release (latest SemVer including pre-releases)

Installation

Maven users

Add this dependency to your project:

<dependency>
 <groupId>com.attestr</groupId>
 <artifactId>attestr-flowx</artifactId>
 <version>0.7.0</version>
</dependency>

Gradle users

Add this dependency to your project's build file:

implementation "com.attestr:attestr-flowx:0.7.0"

Usage

Create new object of AttestrFlowx

AttestrFlowx attestrFlowx = new AttestrFlowx();

Initialize AttestrFlowx with client_key, handshake_id & activity

/**
 * Initialises an instance of AttestrFlowx
 * @param cl Mandatory client key
 * @param hs Mandatory handshake key
 * @param activity Activity on which flow is to be rendered
 */
attestrFlowx.init(clientKey, handShakeID, this);

Launch AttestrFlowx with locale, retry and queryParameters

/**
 * This function launches the flow with the following specifications
 * @param lc Mandatory language code eg. 'en' for English.
 * @param retry Mandatory parameter to set retry as true if re-running the flow for a previously used handshake.
 * @param qr Optional query parameters.
 */
attestrFlowx.launch(locale, retry, qr);

Implement AttestrFlowXEventListener and define success, error and skip handlers

// Implement AttestrFlowXEventListener 
public class ExampleActivity implements AttestrFlowXEventListener {

    // Replace following with your own implementations
    @Override
    public void onFlowXComplete(Map<String, Object> data) {
        Toast.makeText(MainActivity.this, "Flow completed successfully", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onFlowXSkip(Map<String, Object> data) {
        Toast.makeText(MainActivity.this, "Flow skipped", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onFlowXError(Map<String, Object> data) {
        String errorMessage = (String) data.get("message");
        Toast.makeText(MainActivity.this, "Error : " + errorMessage, Toast.LENGTH_SHORT).show();
    }
}

Add the following permission to Android manifest file

<uses-permission android:name="android.permission.INTERNET" />

Version Compatibility

Built for Android API 21+ (Lollipop onwards)

License

attestr-android-sdk is distributed under MIT license. Read more in the LICENSE file.

Contact Us

Write to us at [email protected]