FirebasePhoneNumberVerification
Firebase Phone Number Verification: gets the phone number of a SIM in the device directly from its carrier, with a token signed by Firebase for your backend to verify, instead of sending an SMS code.
It exists on Android only. On iOS, macOS, tvOS, JS and Wasm every operation throws UnsupportedOperationException and enableTestSession does nothing; keep an SMS sign-in for them. See com.google.firebase.pnv.FirebasePhoneNumberVerification for each member's behaviour.
Properties
The underlying Firebase Android SDK object.
The Android-SDK-shaped com.google.firebase.pnv.FirebasePhoneNumberVerification this wraps.
Functions
Enables a test session with testNumberId, a test token generated in the Firebase console, so verification works without a SIM. Call it at most once: on Android a second call throws a FirebasePhoneNumberVerificationException.
Exchanges dcApiResponse, the Firebase token of the Credential Manager's response to the request built with getDigitalCredentialPayload, for the verified phone number and its Firebase PNV token.
Starts a verification through your own Android Credential Manager request: returns the server-signed payload of the request's Digital Credentials query, for the single-use nonce your server generated. Pass the Credential Manager's response to exchangeCredentialResponseForPhoneNumber.
Whether each SIM of the device supports verification, one result per SIM (in a test session, one for the test number). Asks the user for nothing; check it before offering verification, and fall back to SMS otherwise.
Whether the SIM in simSlot (0 or 1) supports verification, as the one result of a list.
Verifies the phone number of a SIM in the device: asks the user for consent through the Android Credential Manager, gets the number from the carrier, and returns it with its Firebase PNV token, which your backend verifies. context is an android.content.Context that is, or wraps, an android.app.Activity. Throws a FirebasePhoneNumberVerificationException if the verification fails.