Back to Expo

Cellular

docs/pages/versions/v54.0.0/sdk/cellular.mdx

latest1.8 KB
Original Source

import APISection from '/components/plugins/APISection'; import { APIInstallSection } from '/components/plugins/InstallSection'; import { AndroidPermissions } from '/components/plugins/permissions'; import { ConfigReactNative } from '/ui/components/ConfigSection';

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.

Installation

<APIInstallSection />

Configuration

<ConfigReactNative>

If you're not using Continuous Native Generation (CNG) or you're using native a android project manually, then you need to add android.permission.READ_PHONE_STATE permission to your project's AndroidManifest.xml. This permission is used for TelephonyManager.

xml
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

This library does not require the more risky READ_PRIVILEGED_PHONE_STATE permission.

</ConfigReactNative>

API

js
import * as Cellular from 'expo-cellular';
<APISection packageName="expo-cellular" apiName="Cellular" />

Error codes

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

Permissions

Android

You must add the following permissions to your app.json inside the expo.android.permissions array.

<AndroidPermissions permissions={['READ_PHONE_STATE']} />

iOS

No permissions required.