You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(android): add support for Firebase Phone Number Verification (PNV)
Bridge all fields from the native Firebase PNV SDK that were previously
omitted. VerificationSupportResult now exposes simSlot, carrierId, and
reason (mapped to VerificationSupportStatus strings).
VerifiedPhoneNumberTokenResult now exposes expirationTimestamp,
issuedAtTimestamp, nonce, and claims. Error handling extracts structured
error codes from FirebasePhoneNumberVerificationException (9 SDK codes).
Added getVerificationSupportInfo(simSlot) overload for querying specific
SIM slots. Updated TypeScript types, e2e tests, local test app, and docs
with error handling table, fallback examples, test-mode setup, and
region/carrier limitations.
-**Carrier-level verification**: Verifies phone numbers directly with the mobile carrier, without SMS.
33
33
-**Support detection**: Check whether the device and carrier support phone number verification before attempting it. This does not require user consent.
34
-
-**Verified phone number**: Retrieve the device's verified phone number. This will present a consent dialog to the user.
34
+
-**Verified phone number**: Retrieve the device's verified phone number as a JWT token containing the phone number, timestamps, nonce, and claims. This will present a consent dialog to the user.
35
35
-**Digital Credential API**: Supports the Android Digital Credential API for custom verification flows.
36
36
37
+
## Region & carrier limitations
38
+
39
+
PNV depends on carrier cooperation. Not all carriers or regions are supported. Before relying on PNV, always call `getVerificationSupportInfo()` to check support. If a SIM slot returns `reason: 'INCAPABLE_DUE_TO_CARRIER_UNSUPPORTED'`, that carrier does not participate in PNV and you should fall back to another verification method (e.g. Firebase Auth SMS).
40
+
41
+
Common reasons verification may be unsupported:
42
+
43
+
| Reason | Meaning |
44
+
|---|---|
45
+
|`CAPABLE`| The SIM's carrier supports PNV. |
46
+
|`INCAPABLE_DUE_TO_CARRIER_UNSUPPORTED`| The carrier does not participate in PNV. |
47
+
|`INCAPABLE_DUE_TO_ANDROID_VERSION`| The device's Android version is too old. |
48
+
|`INCAPABLE_DUE_TO_SIM_STATE`| No SIM inserted, or SIM is in an unusable state. |
49
+
|`CAPABILITY_STATUS_UNSPECIFIED`| The SDK could not determine the status. |
50
+
37
51
# Usage
38
52
39
53
## Check verification support
40
54
41
-
Before attempting verification, check if the device's SIM card and carrier support phone number verification. This call does not require user consent and can be called freely:
55
+
Before attempting verification, check if the device's SIM card(s) support phone number verification. This call does not require user consent and can be called freely:
For testing without a real SIM card, you can enable a test session using a token from the Firebase Console:
208
+
To test without a real SIM card and carrier, use Firebase's test mode. This requires setup in the Firebase Console:
209
+
210
+
1.**Generate a test token**: In the Firebase Console, navigate to Phone Number Verification and generate a test token. Test tokens have a 7-day TTL.
211
+
2.**IAM permissions**: Ensure the service account has the required `firebasepnv.testSessions.create` permission.
212
+
3.**Google system services beta**: On the test device, enroll the Google system services app into the beta channel via Google Play.
213
+
4.**Call `enableTestSession` once**: Pass the token before any verification calls. This must be called only once per app instance — calling it again will reject with `test-session-already-enabled`.
0 commit comments