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
io.socket:socket.io-client:0.8.3
<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"/>
(clientId: @NonNull String, flowId: @Nullable String, buttonTitle: @NonNull String (Optional) metadata: @Nullable Metadata?)
@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);
}
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)
}
@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);
}
}
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)
}
}
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);
}
}
}
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)
}
}
}
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