Expo

Get Started
API Reference

Cellular

expo-cellular provides information about the user’s cellular service provider, such as its unique identifier, cellular connection type, and whether it allows VoIP calls on its network.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb

Installation

expo install expo-cellular

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

import * as Cellular from 'expo-cellular';

Type: boolean | null

Deprecated field, use allowsVoipAsync() instead.

Indicates if the carrier allows making VoIP calls on its network. On Android, this checks whether the system supports SIP-based VoIP API. See here to view more information.

On iOS, if you configure a device for a carrier and then remove the SIM card, this property retains the boolean value indicating the carrier’s policy regarding VoIP. If you then install a new SIM card, its VoIP policy boolean replaces the previous value of this property.

On web, this returns null.

Example

Cellular.allowsVoip; // true or false

Type: string | null

Deprecated field, use getCarrierNameAsync() instead.

The name of the user’s home cellular service provider. If the device has dual SIM cards, only the carrier for the currently active SIM card will be returned. On Android, this value is only available when the SIM state is SIM_STATE_READY. Otherwise, this returns null.

On iOS, if you configure a device for a carrier and then remove the SIM card, this property retains the name of the carrier. If you then install a new SIM card, its carrier name replaces the previous value of this property. The value for this property is null if the user never configured a carrier for the device.

On web, this returns null.

Example

Cellular.carrier; // "T-Mobile" or "Verizon"

Type: string | null

Deprecated field, use getIsoCountryCodeAsync() instead.

The ISO country code for the user’s cellular service provider. On iOS, the value is null if any of the following apply:

  • The device is in airplane mode.
  • There is no SIM card in the device.
  • The device is outside of cellular service range.

On web, this returns null.

Example

Cellular.isoCountryCode; // "us" or "au"

Type: string | null

Deprecated field, use getMobileCountryCodeAsync() instead.

The mobile country code (MCC) for the user’s current registered cellular service provider. On Android, this value is only available when SIM state is SIM_STATE_READY. Otherwise, this returns null. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode. Furthermore, the value for this property is null if any of the following apply:

  • There is no SIM card in the device.
  • The device is outside of cellular service range.

On web, this returns null.

Example

Cellular.mobileCountryCode; // "310"

Type: string | null

Deprecated field, use getMobileNetworkCodeAsync() instead.

The ISO country code for the user’s cellular service provider. On iOS, the value is null if any of the following apply:

  • The device is in airplane mode.
  • There is no SIM card in the device.
  • The device is outside of cellular service range.

On web, this returns null.

Example

Cellular.mobileNetworkCode; // "260"

Example

await Cellular.allowsVoipAsync(); // true or false

  • Promise<boolean | null>

Returns if the carrier allows making VoIP calls on its network. On Android, this checks whether the system supports SIP-based VoIP API. See here to view more information.

On iOS, if you configure a device for a carrier and then remove the SIM card, this property retains the boolean value indicating the carrier’s policy regarding VoIP. If you then install a new SIM card, its VoIP policy boolean replaces the previous value of this property.

On web, this returns null.


Example

await Cellular.getCarrierNameAsync(); // "T-Mobile" or "Verizon"

Returns name of the user’s home cellular service provider. If the device has dual SIM cards, only the carrier for the currently active SIM card will be returned.

On Android, this value is only available when the SIM state is SIM_STATE_READY. Otherwise, this returns null.

On iOS, if you configure a device for a carrier and then remove the SIM card, this property retains the name of the carrier. If you then install a new SIM card, its carrier name replaces the previous value of this property. The value for this property is null if the user never configured a carrier for the device.

On web, this returns null.


Example

await Cellular.getCellularGenerationAsync();
// CellularGeneration.CELLULAR_4G

Returns a promise which fulfils with a Cellular.CellularGeneration enum value that represents the current cellular-generation type.

On web, this method uses navigator.connection.effectiveType to detect the effective type of the connection using a combination of recently observed round-trip time and downlink values. See here to view browser compatibility.


Example

await Cellular.getIsoCountryCodeAsync(); // "us" or "au"

Returns the ISO country code for the user’s cellular service provider.

On iOS, the value is null if any of the following apply:

  • The device is in airplane mode.
  • There is no SIM card in the device.
  • The device is outside of cellular service range.

On web, this returns null.


Example

await Cellular.getMobileCountryCodeAsync(); // "310"

Returns mobile country code (MCC) for the user’s current registered cellular service provider.

On Android, this value is only available when SIM state is SIM_STATE_READY. Otherwise, this returns null. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode. Furthermore, the value for this property is null if any of the following apply:

  • There is no SIM card in the device.
  • The device is outside of cellular service range.

On web, this returns null.


Example

await Cellular.getMobileNetworkCodeAsync(); // "310"

Returns the mobile network code (MNC) for the user’s current registered cellular service provider.

On Android, this value is only available when SIM state is SIM_STATE_READY. Otherwise, this returns null. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode. Furthermore, the value for this property is null if any of the following apply:

  • There is no SIM card in the device.
  • The device is outside of cellular service range.

On web, this returns null.

Describes the current generation of the cellular connection. It is an enum with these possible values:

  • CellularGeneration.UNKNOWN : 0 - Either we are not currently connected to a cellular network or type could not be determined.
  • CellularGeneration.CELLULAR_2G : 1 - Currently connected to a 2G cellular network. Includes CDMA, EDGE, GPRS, and IDEN type connections.
  • CellularGeneration.CELLULAR_3G : 2 - Currently connected to a 3G cellular network. Includes EHRPD, EVDO, HSPA, HSUPA, HSDPA, and UTMS type connections.
  • CellularGeneration.CELLULAR_4G : 3 - Currently connected to a 4G cellular network. Includes HSPAP and LTE type connections.
  • CellularGeneration.CELLULAR_5G : 4 - Currently connected to a 5G cellular network. Includes NR and NRNSA type connections.

CodeDescription
ERR_CELLULAR_GENERATION_UNKNOWN_NETWORK_TYPEUnable to access network type or not connected to a cellular network