npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-device-country

v1.0.1

Published

Get device country by Network and SIM

Readme

expo-device-country

Expo module that exposes the device's ISO 3166-1 alpha-2 country code using SIM and network data where available. Ideal for tailoring content or flows by a user's detected country without asking for additional permissions.

iOS note: Apple does not expose an API for the currently registered network country, so getNetworkCountry() always returns null on iOS. Only SIM/home carrier data is available there.

New Architecture: Fully compatible with Expo's New Architecture out of the box.

Features

  • Synchronous helpers to read the SIM-issued country code as a two-letter ISO string, e.g. US or TH.
  • On Android, access to both the SIM country (TelephonyManager.getSimCountryIso) and currently registered network country (TelephonyManager.getNetworkCountryIso).
  • Designed for Expo Router/React Navigation and other client-side flows that need country awareness without server round-trips.
  • Seamless autolinking in Expo apps and React Native projects configured with Expo modules.

Installation

Expo app projects

npx expo install expo-device-country

This works for Expo projects created with npx create-expo-app, including apps built with EAS or classic builds.

React Native projects (with Expo modules)

npm install expo-device-country
# or
# yarn add expo-device-country
# pnpm add expo-device-country

npx pod-install

Make sure the expo package is configured by following Install Expo modules in React Native projects.

Usage

import ExpoDeviceCountry from "expo-device-country";

const simCountry = ExpoDeviceCountry.getSimCountry();
const networkCountry = ExpoDeviceCountry.getNetworkCountry();

if (simCountry) {
  console.log(`SIM country: ${simCountry}`);
}

// Fall back to network country when SIM data is unavailable
const resolvedCountry = simCountry ?? networkCountry ?? "US";

Both methods return a two-letter uppercase country code or null if that dataset is not available on the device.

API

| Method | Description | Return type | Platforms | | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------------------------------------------ | | getSimCountry() | Reads the home carrier/SIM country. On iOS this uses CoreTelephony; on Android it uses TelephonyManager#getSimCountryIso. No additional permissions required. | string \| null | iOS: available (SIM only); Android: available | | getNetworkCountry() | Reads the currently registered mobile network country. Returns null on devices without cellular service or on iOS, where the data is unavailable. | string \| null | iOS: not available; Android: available |

Note: Web support is not available. The module can only be imported on native platforms.

Example app

The example/ directory contains a minimal Expo app that consumes this module.

cd example
npx expo start

Platform notes

  • iOS: getSimCountry uses CTTelephonyNetworkInfo and returns null on Wi-Fi only devices or when no SIM is present. getNetworkCountry always returns null because iOS does not provide this information.
  • Android: Uses TelephonyManager to resolve SIM and network countries. A value is only returned on real devices with an active SIM or network registration.

License

MIT