Prove® Platform Android SDK
Learn how to integrate the client-side Android SDK into your native application.
Installation
The Android SDK is a set of lightweight libraries (267 KB total compressed size for the minimum required components without external dependencies). The libraries are delivered as Android Archive Repository (.aar) files. The minimum supported version of Android is v7 (level 24). Prove’s Android SDK recommends the previous 3 major Android versions (Android v12 today), but we’ve seen successful transactions with Android v8 in production.
Prove manages a maven repository with Android binaries to enable simple integration with Gradle.
Update the dependencies object in the build.gradle file:
You’ll also need to point to the new repository by updating your settings.gradle file with the Maven repo:
The following needs to be added to the build.gradle file to also download dependency libraries:
If you receive an error message on the application@fullBackupContent
value, you should be able to resolve it by adding this line of code to your application AndroidManifest.xml file inside the <application>...</application>
node (add it as an attribute to the opening application
tag):
Permissions
Since permissions are automatically merged from the library’s manifest (SDKs) into the main application, the Prove Auth SDK (and its children SDKs) merges the following non-dangerous permissions:
Send the Type of Flow: Mobile
Unlike the Web SDK, when using the Android SDK, the mobile flow must be used. You should pass mobile
to the Start()
function on the server. In a mobile flow, Mobile Auth℠ is attempted first and if that fails, it will perform OTP validation on the mobile phone.
In the mobile flow, once either Mobile Auth or the OTP validation is complete, the AuthFinishStep function will be called.
Mobile Auth
In order for Mobile Auth to succeed, the end user must not be using a VPN.
Authenticate()
The SDK requires an authToken
as a parameter for the Authenticate()
function. This token is returned from the Start()
call of the server SDK. The token is session specific so it can only be used for a single flow so it cannot be reused. It also expires after 15 minutes.
Retrieve authToken
To start the flow, you’ll need to send a request to your backend server with the phone number, flow type, and an optional challenge of either the date of birth (format: YYYY-MM-DD) or social security number (format: last 4 digits).
Setup Authenticator
Once you have the authToken, build the authenticator for the mobile flow.
Cellular data connection might not always be available during testing. The Builder
class offers a withTestMode(boolean testMode)
method, which permits simulated successful session results while connected to Wi-Fi network only (without a cellular data connection available). This feature is particularly useful for testing on Emulator. This can only be used in Sandbox mode.
Performing the Authentication
The ProveAuth
object is thread-safe and can be used as a singleton. Most Prove Auth methods are blocking and therefore cannot be performed in the main application thread. The application is required to manage threads, for instance, with an executor service, which provides at least two threads since SDK may have more then one simultaneous blocking requests.
Validate the Mobile Phone
In the AuthFinishStep, you’ll specify a function to call once the possession checks are complete on the mobile phone. This endpoint on your backend server will then call the Validate()
function to check if the phone number was validated. If it was successful, the server should return the results from the Challenge()
function that will include user information. If it was not successful, the server won’t return user information. We’ve included a few example fields that should be returned and then pre-filled on a form for the user to verify.
OTP Configuration
There are two functions to implement for the OTP handling - a start and a finish step.
Note: Retry functionality is not supported in OTP.
In order to set the OTP handlers, OtpStartStep
and OtpFinishStep
interfaces should be implemented. The Java snippet has an example.
OtpStartStep
example:
OtpFinishStep
example:
Verify the User Information
Once the user has made any edits to their pre-fill information, you should submit that information to the backend server so the Complete()
call can then verify the user information.
Was this page helpful?