How to Integrate

Before you start, you can also check VGS Show SDK GitHub Pagearrow-up-right.

Make sure that you check our best practices to ensure secure configurations.

Quickstart from Dashboard

You should have your organization registered at the VGS Dashboardarrow-up-right. Sandbox vault will be pre-created for you. You should use your vault id to start reveal data. Follow integration guide below.

Integrate VGS Show SDK into Your Android Project

To use the SDK in your project you just need to add the following line of dependency in your module build.gradlearrow-up-right file and then rebuild project.

Check out our latest releasesarrow-up-right.

dependencies {
    //...
    implementation 'com.verygoodsecurity:vgsshow:<latest-version>'
    //...
}

Include additional configurations

In case you have minifyEnabled enabled don't forget to add next line to your project R8 configuration.

//...
-keep public class com.google.android.material**  { *; }
//...

Configure Your App

Specifying app manifest

Declaration of FileProvider in app manifest required only for VGS Show SDK v1.2.0 - v1.3.2.

Add a <provider> element to your app manifest. Set the android:name attribute to the FileProvider you created. Set the unique android:authorities attribute to a URI authority. Set the element android:resource attribute to @xml/file_paths (without specifying the .xml extension).

Define <paths> in file_paths.xml file.

Please follow the linkarrow-up-right for more information.

Initialize SDK

To initialize VGSShow, you have to set your vault id and Environment type.

Configuring UI Elements

Add the VGS secure field to R.layout.main_activity layout file:

You must set up contentPath to the VGSTextView in other way field will be ignored by VGSShow.

Revealing Sensitive Data on Android

Use subscribe(VGSView) to attach a view to VGSShow.

If you use kotlin please check if you added apply plugin: 'kotlin-android-extensions' in your build gradle, or use findViewById(R.id.infoField) otherwise.

Reveal data

Create a request payload with fieldNames and related aliases.

Call requestAsync to execute and send data on the VGS Server on a background thread, and call request to execute the request on the main thread.

Executing network request on main thread will cause android.os.NetworkOnMainThreadExceptionprivate fun createRequestPayload(): JSONObject { return JSONObject(mapOf("<CONTENT_PATH>" to "<REVEAL_ALIAS>"))

Handling Responses

To receive the response status, you need to implement VGSOnResponseListener:

See also:

Last updated