React Native Get Android iOS Device Unique ID Dynamically Example

Every mobile phone device in the world has its unique ID(Identify Signature) which makes with the combination of Alphabetic and Numeric characters. Unique device ID is used in Push Notification, identify a device uniquely at login app and most of money making app’s usages this to prevent multiple app installation in same device. Both android and iOS devices supports Unique ID and using the react-native-device-info NPM library we can easily retrieve Get Android iOS Device Unique ID Dynamically on button click in Android iOS react native application.

Contents in this project Get Android iOS Device Unique ID Dynamically on Button Click in iOS Android React Native App:

1. Open your react native project folder in Command Prompt / Terminal.

2. Execute the npm install --save react-native-device-info@0.11.0 command in your react native’s project like i did in below screenshot.

3. Now we need to execute react-native link react-native-device-info command in order to link this installed library to our current react native project.

4. Import Platform, StyleSheet, View, Text and TouchableOpacity component in your project.

5. Import react-native-device-info module in your app using a variable named as DeviceInfo. We would use this object to retrieve device unique id.

6. Create constructor() in your project and make a State named as DeviceID , this state is used to hold the Unique device id.

7. Create a function named as getDeviceID(), Inside this function we would simply get the unique device id using DeviceInfo.getUniqueID() method and store this into State. We would call this function on Button onPress event.

8. Create a Root View in render’s return block and Inside this View would make a Text component and 1 TouchableOpacity button.

9. Creating Style.

10. Complete source code for App.js File :

Screenshot in Android device:

Get Android iOS Device Unique IDScreenshot in iOS device:


  1. It shows evaluating ‘RNDeviceInfo.uniqueId’

  2. Hey Good tutorial! keep it up.
    Could you please make a tutorial of how to make confirm dialog with alert and without customization?

  3. It is nice!

    How do we get device IMEI number?

    • Rohit i will soon publish tutorial on getting IMEI number 🙂 .

    • I am getting UDID for authentication of devices. It working fine on all models but on iPhone 6s(11.4) it giving me different UDID’s on each attemts. I don’t know why!. Please help me to figure it out. Thank You

  4. I get an error “undefined is not an object (evaluating ‘RNDeviceInfo.uniqueId’)”

  5. I am getting
    undefined is not a function (evaluating ‘DeviceInfo.getUniqueID()’)

  6. brother make a lesson of fresher interview questions.

  7. Getting a different ID with getUniqueId() on Android in debug mode and release mode

    debug mode : ‘Unique ID’, ‘:’, ‘0bb6d96aef12fcc3’
    release mode: ‘Unique ID’, ‘:’, ‘2d94525cc9f2dbe4’

    Version 8.3.3
    Affected OS android & ios
    OS Version Latest
    Current behavior
    Getting a different ID with getUniqueId() on Android in debug mode and release mode

    debug mode : ‘Unique ID’, ‘:’, ‘0bb6d96aef12fcc3’
    release mode: ‘Unique ID’, ‘:’, ‘2d94525cc9f2dbe4’

    Expected behavior
    device info ID should be unique in all the releases.

Leave a Reply

Your email address will not be published.