Initiate Google Phone Hint API for Phone Number Suggestion

The Google Phone Hint API suggests phone numbers stored on the user’s device, prompting them to choose one. If selected, the number can be applied to the input field, reducing manual entry and errors. OTPless offers this feature for a seamless phone number entry process during authentication or registration.

Register OtplessPhoneHint in the onCreate() of your Activity.kt file.

import com.otpless.v2.android.sdk.main.OtplessPhoneHint;

OtplessPhoneHint.register(this)

Call the show() method of OtplessPhoneHint whenever required.

import com.otpless.v2.android.sdk.main.OtplessPhoneHint

OtplessPhoneHint.show(activity) { phoneHintResponse ->
    if (!phoneHintResponse.phoneNumber.isNullOrBlank()) {
        // Use phone number
    } else {
        // Handle error: 
        val errorMessage = phoneHintResponse.error
    }
}