PhoneNumberType

What kind of line a phone number is, as classified by libphonenumber's per-region metadata.

Most flows that collect a phone number actually want a subset of these. An SMS one-time-code flow needs a number that can receive SMS, which means Mobile; a landline, a pager or a premium line will pass plain validity and then silently never receive the code. Restricting the accepted types moves that failure from "the user never gets their code" to "the field says so while they are still on the screen".

Pass a set of these as allowedNumberTypes to the phone field or to com.ezzy.ccp.countrypicker.phone.PhoneNumberValidator.evaluate. An empty set — the default — accepts any type, which is the right behaviour when the number is only being stored.

See also

for the case that makes naive type matching wrong.

Entries

Link copied to clipboard

A landline.

Link copied to clipboard

A mobile number. The type to require for SMS and WhatsApp flows.

Link copied to clipboard

The region's numbering plan does not separate landline from mobile, so the number is one of the two and libphonenumber cannot say which.

Link copied to clipboard

Freephone (e.g. +1 800).

Link copied to clipboard

Premium-rate, charged above the standard rate.

Link copied to clipboard

Shared-cost, billed partly to the caller.

Link copied to clipboard

Voice over IP.

Link copied to clipboard

A personal number that redirects to a chosen line.

Link copied to clipboard

A pager.

Link copied to clipboard

Universal Access Number — a company-wide number with no fixed location.

Link copied to clipboard

A voicemail box.

Link copied to clipboard

libphonenumber has no classification for this number in this region.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard
expect val name: String
Link copied to clipboard
expect val ordinal: Int

Functions

Link copied to clipboard

Whether this actual type satisfies a requirement for required.

Link copied to clipboard

Whether this type satisfies any member of required, or true when required is empty.

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.