Expo get unique device id without ejecting Expo get unique device id without ejecting android android

Expo get unique device id without ejecting


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 * as SecureStore from 'expo-secure-store';import 'react-native-get-random-values';import { v4 as uuidv4 } from 'uuid';let uuid = uuidv4();await SecureStore.setItemAsync('secure_deviceid', JSON.stringify(uuid));let fetchUUID = await SecureStore.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)


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


Guess you can use facebook module for this purpose.https://docs.expo.io/versions/latest/sdk/facebook-ads/#currentdevicehash

Not sure what happens under hood - but looks like it unique between app reinstal, device restart etc.