Skip to content Skip to sidebar Skip to footer

Expo Get Unique Device Id Without Ejecting

This library allows you to get unique device id / Mac address of Android devices, which doesn't change after reinstallation. Expo.Constants.deviceId changes after every reinstallat

Solution 1:

For Expo IOS theres currently very limited options, Since Apple forbids getting private device info. We will need to create our own unique identifier below.

My solution is a combination of uuid and Expo SecureStore works for IOS and Android.

import * asSecureStorefrom'expo-secure-store';
import'react-native-get-random-values';
import { v4 as uuidv4 } from'uuid';


let uuid = uuidv4();
awaitSecureStore.setItemAsync('secure_deviceid', JSON.stringify(uuid));
let fetchUUID = awaitSecureStore.getItemAsync('secure_deviceid');
console.log(fetchUUID)

This solution will work even if app gets reinstalled, or if user switches devices and copy's all data to new device. (Expo.Constants.deviceId is deprecated and will be removed in SDK 44)

Solution 2:

Solution 3:

Just use getuniqueid() method from react-native-device-info. Works on iOS and android to uniquely identify a device .

Post a Comment for "Expo Get Unique Device Id Without Ejecting"