Verifapp
Android SDK Introduction
VerifApp provides complete integration with all mobile operators at the backend. Reach them consistently with a single SDK. We have procured the routes and negotiated with all relevant third parties so you can scale quickly and reliably. We manage all governance with countries and operators, so this never changes. Create meaningful customer journeys on Verifapp’s integrated platform.
The SDK supports verifications through different channels. The details of the means of verification are as follows:
- Auto-fetching
- Auto-detect
- Whatsapp Sms
- MTSMS
This document outlines step-by-step instructions to integrate VerifApp android SDK into your application.
The SDK works for Android API 14 and above.
How does the Verifapp work
Verification of a phone number is performed in two steps
- Request a verification code
- Verify the received code
If all of the permissions are provided (see Permissions), the Verification SDK attempts to automatically verify any matching code that is received through SMS or call during the verification process.
This means that during a call verification, the verification SDK will automatically hang up the incoming call if (and only if) it matches the expected pattern.
During SMS verification, if content of the incoming SMS, matches our desired criteria then your number will be verified.
<uses-permission android:name=”android.permission.READ_CALL_LOG” />
<uses-permission android:name=”android.permission.READ_PHONE_STATE” />
Step 1 - Get SDK key
To use Verifapp SDK you will need Verifapp SDK Key. The SDK key is shared during the onboarding process. Mostly it is shared on email. In case you have not received the key kindly contact your account manager.
Step 2 - SDK Integration
Upgrade to the latest stable version of Android Studio and the latest Android Gradle Plugin you can get our integrated in your app by following these easy steps:
Step 2 - SDK Integration
1. Open Android Studio
2. Create new project
3. Open App level gradle
4. Add repositories section and add URL
5. Add dependencies in build.gradle
6. Sync project
7. Open Main activity
8. Implement OtpListener interface
9. Initialize OtpManager in onCreate and add init method
10. Add implementation for onNotifyUser and Add method verifyPhoneNumber
11. Add implementation for onPhoneNumberVerifie
2. Create new project
3. Open App level gradle
4. Add repositories section and add URL
5. Add dependencies in build.gradle
6. Sync project
7. Open Main activity
8. Implement OtpListener interface
9. Initialize OtpManager in onCreate and add init method
10. Add implementation for onNotifyUser and Add method verifyPhoneNumber
11. Add implementation for onPhoneNumberVerifie
1. Open Android Studio
Open Android Studio to create a new project. Click on “Start a new Android Studio Project”
2. Create new project
3. Open App level gradle
4. Add repositories section and add URL
repositories {
mavenCentral()
}
mavenCentral()
}
5. Add dependencies in build.gradle
implementation‘com.mercurialminds.sdk:verif-app:1.x.x’
6. Sync project
7. Open Main activity
8. Implement OtpListener interface
override fun onNotifyUser(code: OtpCodes, message: String, timeOut: Long?) {
TODO(“Not yet implemented”)
}
override fun onPhoneNumberVerified(method: String, isVerified: Boolean) {
TODO(“Not yet implemented”)
}
TODO(“Not yet implemented”)
}
override fun onPhoneNumberVerified(method: String, isVerified: Boolean) {
TODO(“Not yet implemented”)
}
9. Initialize OtpManager in onCreate and add init method
override fun onCreate(savedInstanceState: Bundle?) {
otp = OtpManager()
init()
}
private fun init() {
var token = “ENTER TOKEN HERE”
otp?.initialize(token, this, this,
lifecycle
)
}
otp = OtpManager()
init()
}
private fun init() {
var token = “ENTER TOKEN HERE”
otp?.initialize(token, this, this,
lifecycle
)
}
10. Add implementation for onNotifyUser and Add method verifyPhoneNumber
private fun verifyPhoneNumber() {
otp?.verifyPhoneNumber(“ENTER PHONE NUMBER HERE”)
}
override fun onNotifyUser(code: OtpCodes, message: String, timeOut: Long?) {
when (code) {
OtpCodes.SDK_INITIALIZED -> {
verifyPhoneNumber()
}
}
}
otp?.verifyPhoneNumber(“ENTER PHONE NUMBER HERE”)
}
override fun onNotifyUser(code: OtpCodes, message: String, timeOut: Long?) {
when (code) {
OtpCodes.SDK_INITIALIZED -> {
verifyPhoneNumber()
}
}
}
11. Add implementation for onPhoneNumberVerifie
override fun onPhoneNumberVerified(method: String, isVerified: Boolean) {
Snackbar.make(mainView, “Number Verified”, Snackbar.LENGTH_SHORT)
.show()
}
Snackbar.make(mainView, “Number Verified”, Snackbar.LENGTH_SHORT)
.show()
}
Note:
Proguard
Some classes in the SDK should not be renamed or optimized via proguard. The SDK ships with a proguard.txt that is used by the gradle to automatically configure proguard correctly.
Google Developer Console
If you are opting for permission based sdk then you need to make following changes in Google Play developer console under Permissions declaration form
- Core functionalities: Call-based OTP account verification
- Video instructions: https://youtu.be/J7bh71O68QQ
- Select all Declarations check-boxes