2.1.1.1.3 Deep Link Method
Overview
The Deep Link Verification process allows users to verify their phone numbers by interacting with an external application, such as Telegram or WhatsApp, and then returning to your app to complete the verification.
Get started
- Initialize VerifySpeed: Follow the initialize instructions.
 
Verifying Phone Numbers with Deep Link
Use verifyPhoneNumberWithDeepLink with these parameters:
deepLink: URL that directs users to the external app for verification.verificationKey: Unique key provided by your backend to ensure verification integrity.callBackListener: Callback interface to handle success and failure cases:onSuccess: Triggered on successful verification, returning atokento retrieve the user's phone number.onFail: Triggered if verification fails, providingerrordetails including type and message.
- Kotlin
 - Java
 
VerifySpeed.verifyPhoneNumberWithDeepLink(
    "DEEP_LINK", // deep link provided by your backend
    "VERIFICATION_KEY", // unique key provided by your backend
    true, // redirect to the store if the app is not installed
    object : VerifySpeedListener { // callback listener for success and failure cases
        override fun onSuccess(token: String) {
            Log.d("VerifySpeed", "Token: $token")
        }
        override fun onFail(error: VerifySpeedError) {
            Log.d("VerifySpeed", "Error: ${error.message}")
        }
    }
)
VerifySpeed.verifyPhoneNumberWithDeepLink(
    "DEEP_LINK", // deep link provided by your backend
    "VERIFICATION_KEY", // unique key provided by your backend
    true, // redirect to the store if the app is not installed
    new VerifySpeedListener() { // callback listener for success and failure cases
        @Override
        public void onSuccess(String token) {
            Log.d("VerifySpeed", "Token: " + token);
        }
        @Override
        public void onFail(VerifySpeedError error) {
            Log.d("VerifySpeed", "Error: " + error.getMessage());
        }
    }
);
Handling app resumption
When users return from the external app, call notifyOnResumed() to complete the verification process:
VerifySpeed.notifyOnResumed()
Example
For complete implementation examples, see:
Jetpack Compose:
Android Views:
When testing the example project, you'll need to integrate with your backend using these recommended request/response structures (which you can modify as needed).
Search for keywords TIP if you want to know how to implement Deep Link Verification.
Best Practices
- 
Use a dedicated activity for deep link verification
- Create a separate activity (e.g., 
MessageActivity) specifically for handling deep link verification instead of using yourMainActivity - Benefits of this approach:
- Prevents unnecessary 
notifyOnResumed()calls when there's no active verification in progress - Provides better lifecycle management for the verification flow
 - Activity can self-destruct after successful verification
 
 - Prevents unnecessary 
 - Implementation considerations:
- Launch this dedicated activity when starting verification
 - Implement 
onResume()to callVerifySpeed.notifyOnResumed() - Close the activity after verification completes or fails
 
 
 - Create a separate activity (e.g., 
 - 
Activity Lifecycle Management
- Always call 
VerifySpeed.notifyOnResumed()in theonResume()method of your verification activity - Ensure proper cleanup by finishing the activity after verification completes
 - This prevents verification state from persisting longer than necessary
 
 - Always call 
 
Using a dedicated activity for deep link verification is highly recommended as it provides better control over the verification flow and prevents potential issues with notifyOnResumed() being called at inappropriate times.
Implementation example
Here's an example of how to implement the dedicated activity pattern:
- Define the Activity in AndroidManifest.xml
 
<activity
    android:name=".ui.message.MessageActivity"
    android:exported="false"
    android:theme="@style/Theme.Example" />
- Implement the Dedicated Verification Activity
 
- Kotlin
 - Java
 
class MessageActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // Get the method from intent
        val method = intent.getStringExtra("method") ?: return finish()
        // Set activity for VerifySpeed
        VerifySpeed.setActivity(this)
        // UI implementation
        ...
    }
    override fun onResume() {
        super.onResume()
        // Notify when activity is resumed for Deep Link Process
        VerifySpeed.notifyOnResumed()
    }
}
class MessageActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Get the method from intent
        val method = intent.getStringExtra("method") ?: return finish()
        // Set activity for VerifySpeed
        VerifySpeed.setActivity(this)
        // UI implementation
        ...
    }
    @Override
    protected void onResume() {
        super.onResume();
         // Notify when activity is resumed for Deep Link Process
        VerifySpeed.notifyOnResumed();
    }
}
- Launch the Verification Activity
 
- Kotlin
 - Java
 
val intent = Intent(context, MessageActivity::class.java).apply {
    putExtra("method", method.methodName)
}
context.startActivity(intent)
Intent intent = new Intent(this, MessageActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("method", methodName);
startActivity(intent);
This implementation follows the best practices by:
- Using a dedicated activity for verification
 - Properly handling lifecycle events
 - Cleaning up after verification completes
 - Managing the verification state effectively
 
Remember to destroy the activity after verification completes to prevent unnecessary notifyOnResumed() calls in subsequent app launches.