Skip to content

aleksei-klyshnikov-mati/mati-android-sdk

 
 

Repository files navigation

Mati Android SDK documentation

Install Mati SDK via Gradle

Ensure that your top-level build.gradle contains a reference to the following repository:

 jcenter()

Add this line into gradle dependencies

implementation 'com.matilock:mati-global-id-sdk:3.0.2'

Sync project with gradle files

! Dependencies (will be automatically installed with Mati library)
io.socket:socket.io-client:0.8.3

Usage

1) You now need to place MatiButton inside your layout

<com.matilock.mati_kyc_sdk.MatiButton
    android:id="@+id/matiKYCButton"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    mati:text="$CUSTOM_TITLE" 
    android:layout_margin="16dp"
    android:layout_gravity="center"/>

2) In order to authorize app and start verification, call setParams with the following arguments:

(clientId: @NonNull String, flowId: @Nullable String, buttonTitle: @NonNull String (Optional) metadata: @Nullable Metadata?)

Java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    
    ...

    this.<MatiButton>findViewById(R.id.matiKYCButton).setParams(
        "CLIENT_ID", 
        "FLOW_ID", 
        "BUTTON_TITLE", 
        METADATA);
}
Kotlin
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    setContentView(R.layout.activity_main);

    ...
    
    findViewById<MatiButton>(R.id.matiKYCButton).setParams(
        "CLIENT_ID", 
        "FLOW_ID", 
        "BUTTON_TITLE", 
        METADATA)
}

3) Listen for KYCActivity result

Java
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if(requestCode == KYCActivity.REQUEST_CODE) {
        if(resultCode == RESULT_OK) {
            Toast.makeText( this,"SUCCESS!!!", Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText( this,"CANCELLED!!!", Toast.LENGTH_LONG).show();
        }
    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
Kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    if (requestCode == KYCActivity.REQUEST_CODE) {
        if (resultCode == RESULT_OK) {
            Toast.makeText(this, "SUCCESS!!!", Toast.LENGTH_LONG).show()
        } else {
            Toast.makeText(this, "CANCELLED!!!", Toast.LENGTH_LONG).show()
        }
    } else {
        super.onActivityResult(requestCode, resultCode, data)
    }
}

4) Check complete code for your activity

Java
public class YourActivity extends AppCompatActivity implements MatiCallback {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        this.<MatiButton>findViewById(R.id.matiKYCButton).setParams(
            "CLIENT_ID", 
            "FLOW_ID", 
            "BUTTON_TITLE"
            new Metadata.Builder()
                .with("key_1", "value1")
                .with("key2", 2)
                .build());
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if(requestCode == KYCActivity.REQUEST_CODE) {
            if(resultCode == RESULT_OK) {
                Toast.makeText( this,"SUCCESS!!!", Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText( this,"CANCELLED!!!", Toast.LENGTH_LONG).show();
            }
        } else {
            super.onActivityResult(requestCode, resultCode, data);
        }
    }
}
Kotlin
class SecondActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_second)

        findViewById<MatiButton>(R.id.matiKYCButton).setParams(
            "CLIENT_ID", 
            "FLOW_ID", 
            "BUTTON_TITLE"
            Metadata.Builder()
                .with("key_1", "value1")
                .with("key2", 2)
                .build())
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        if (requestCode == KYCActivity.REQUEST_CODE) {
            if (resultCode == RESULT_OK) {
                Toast.makeText(this, "SUCCESS!!!", Toast.LENGTH_LONG).show()
            } else {
                Toast.makeText(this, "CANCELLED!!!", Toast.LENGTH_LONG).show()
            }
        } else {
            super.onActivityResult(requestCode, resultCode, data)
        }
    }
}

Requirements

Our SDK requires Android v5.0 (API v21) or above.

For Mati SDK below 3.x.x please use this documentation https://github.com/GetMati/mati-android-sdk/blob/master/README_old__2_x_x_.md

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%