FirebasePhoneNumberVerification

public interface FirebasePhoneNumberVerification


Entry point for Firebase Phone Number Verification.

Summary

Public methods

abstract @NonNull Task<@NonNull VerifiedPhoneNumberTokenResult>

Completes the phone number verification process by exchanging a response from Credential Manager for a verified phone number token.

abstract @NonNull Task<@NonNull String>

Prepares for a phone number verification flow by performing preflight checks and returning a digital credential payload for use with Android's Credential Manager.

default static final @NonNull FirebasePhoneNumberVerification

Returns an instance of FirebasePhoneNumberVerification using the default FirebaseApp and its application context.

default static final @NonNull FirebasePhoneNumberVerification

Returns an instance of FirebasePhoneNumberVerification for the given Context and the default FirebaseApp.

default static final @NonNull FirebasePhoneNumberVerification

Returns an instance of FirebasePhoneNumberVerification for the given FirebaseApp.

default static final @NonNull FirebasePhoneNumberVerification
getInstance(@NonNull FirebaseApp firebaseApp, @NonNull Context context)

Returns an instance of FirebasePhoneNumberVerification for the given FirebaseApp and a Context.

abstract @NonNull Task<@NonNull List<@NonNull VerificationSupportResult>>

Checks if phone number verification is supported for all SIMs.

abstract @NonNull Task<@NonNull List<@NonNull VerificationSupportResult>>

Checks if phone number verification is supported for a specific simSlot.

abstract @NonNull Task<@NonNull VerifiedPhoneNumberTokenResult>

Initiates the phone number verification process by getting a signed request, interacting with Credential Manager, and exchanging the response for a verified phone number token.

Public methods

exchangeCredentialResponseForPhoneNumber

abstract @NonNull Task<@NonNull VerifiedPhoneNumberTokenResultexchangeCredentialResponseForPhoneNumber(@NonNull String dcApiResponse)

Completes the phone number verification process by exchanging a response from Credential Manager for a verified phone number token.

getDigitalCredentialPayload

abstract @NonNull Task<@NonNull StringgetDigitalCredentialPayload(@NonNull String nonce)

Prepares for a phone number verification flow by performing preflight checks and returning a digital credential payload for use with Android's Credential Manager.

Parameters
@NonNull String nonce

A unique string used to prevent replay attacks. screen.

getInstance

default static final @NonNull FirebasePhoneNumberVerification getInstance()

Returns an instance of FirebasePhoneNumberVerification using the default FirebaseApp and its application context.

Note that for methods that require an Activity context, using the result of this method will result in an IllegalArgumentException.

getInstance

default static final @NonNull FirebasePhoneNumberVerification getInstance(@NonNull Context context)

Returns an instance of FirebasePhoneNumberVerification for the given Context and the default FirebaseApp. Note that for methods that require an Activity context, providing a non-Activity context will result in an IllegalArgumentException.

getInstance

default static final @NonNull FirebasePhoneNumberVerification getInstance(@NonNull FirebaseApp firebaseApp)

Returns an instance of FirebasePhoneNumberVerification for the given FirebaseApp. It will be initialized with the application context.

Note that for methods that require an Activity context, using the result of this method will result in an IllegalArgumentException.

getInstance

default static final @NonNull FirebasePhoneNumberVerification getInstance(@NonNull FirebaseApp firebaseApp, @NonNull Context context)

Returns an instance of FirebasePhoneNumberVerification for the given FirebaseApp and a Context. The instance will be initialized with the provided Context. Note that for methods that require an Activity context, providing a non-Activity context will result in an IllegalArgumentException.

getVerificationSupportInfo

abstract @NonNull Task<@NonNull List<@NonNull VerificationSupportResult>> getVerificationSupportInfo()

Checks if phone number verification is supported for all SIMs.

This is a pre-check to determine if the verification flow is likely to succeed and does not require user consent.

The returned Task completes with a list of VerificationSupportResult objects containing information about verification support for all SIM slots.

getVerificationSupportInfo

abstract @NonNull Task<@NonNull List<@NonNull VerificationSupportResult>> getVerificationSupportInfo(int simSlot)

Checks if phone number verification is supported for a specific simSlot.

This is a pre-check to determine if the verification flow is likely to succeed and does not require user consent.

The returned Task completes with a VerificationSupportResult object containing information about verification support for the specified simSlot.

Throws IllegalArgumentException if the provided simSlot is not 0 or 1.

getVerifiedPhoneNumber

abstract @NonNull Task<@NonNull VerifiedPhoneNumberTokenResultgetVerifiedPhoneNumber()

Initiates the phone number verification process by getting a signed request, interacting with Credential Manager, and exchanging the response for a verified phone number token. This function handles the entire end-to-end flow.