rn-imei

Get IMEI in react-native (Android only)

Usage no npm install needed!

<script type="module">
  import rnImei from 'https://cdn.skypack.dev/rn-imei';
</script>

README

react-native-imei

A library for React Native apps to easily get the IMEI (International Mobile Equipment Identity) for both single- and multi-SIM devices running Android 4.1+.

IMEI is guaranteed to be non-empty string, otherwise you will get an exception.

Exception is thrown if:

  • Permission is missing
  • Fails to get non-empty imei
  • Device is not Android device

Warning!

In almost all cases, you do not want to be using the IMEI. It is only available on Android devices with a SIM slot, and Android 10+ requires special permissions to read it.

Google Play

Google Play has strict rules regarding the use of hardware identifiers such as IMEI numbers. Make sure your use of this library is compliant with current policies if you plan to distribute your Android app using Google Play.

Hint: if you are not 100% sure your use case is allowed, the answer is usually no.

iOS

Apple does not allow apps to access device identiying information such as IMEI. For more information please look at this StackOverflow question.

Installation

npm install react-native-imei --save

# or with yarn
yarn add react-native-imei

# Remember to link after install!
react-native link react-native-imei

Example

const IMEI = require('react-native-imei');
IMEI.getImei().then(imeiList => {
    console.log(imeiList); // prints ["AABBBBBBCCCCCCD"]
});