constants.installationid: how to "implement it on your own"

Please provide the following:

  1. SDK Version: 40
  2. Platforms(Android/iOS/web/all): all

Hi, in the documentation for constants under installationid it says:

This property is deprecated and will be removed in SDK 44. Please implement it on your own using expo-application’s androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on Web.

I see so many people asking about a way to identify which device the user is on, so why not have a way to identify the device? I need one in my app. Also, how do you implement it on your own with a storage api? What methods of the storage api generate a unique deviceid? I looked through the Secure Store documentation and I don’t see any methods that generate device id’s. So, not only is installationid being removed, but there’s no assistance, i can find, about how to implement it on your own.

The 4 methods I see in the SecureStore package are: isAvailableAsync(), getItemAsync(), setItemAsync(), and deleteItemAsync(). Which of those can generate a device id or installation id?


Based on [repo] Deprecate installationId by sjchmiela · Pull Request #10997 · expo/expo · GitHub, the code from expo/getInstallationIdAsync.ts at master · expo/expo · GitHub (and .android.ts and .web.ts) could probably help. But I would also appreciate a more official guide on how to do this!


I am looking for the samething.

This property is deprecated and will be removed in SDK 44. Please implement it on your own using expo-application’s androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on Web.
Android only. The value of Settings.Secure.ANDROID_ID. This is a hexademical string unique to each combination of app-signing key, user, and device. The value may change if a factory reset is performed on the device or if an APK signing key changes. For more information about how the platform handles ANDROID_ID in Android 8.0 (API level 26) and higher, see Android 8.0 Behavior Changes. On iOS and web, this value is null.
Note: In versions of the platform lower than Android 8.0 (API level 26), this value remains constant for the lifetime of the user's device. See the Android_ID official docs for more information.
E.g., "dd96dec43fb81c97"
iOS only. Gets the iOS "identifier for vendor" (IDFV) value, a string ID that uniquely identifies a device to the app’s vendor. This method may sometimes return nil, in which case wait and call the method again later. This might happen when the device has been restarted before the user has unlocked the device.
The OS will change the vendor identifier if all apps from the current app's vendor have been uninstalled.
A Promise that resolves to a string specifying the app's vendor ID. Apps from the same vendor will return the same ID. See Apple's documentation for more information about the vendor ID's semantics.
await Application.getIosIdForVendorAsync();
// "68753A44-4D6F-1226-9C60-0050E4C00067"

My guess is that the documentation is telling us to use those 2 methods for identifying uniquely the device and then using expo-secure-store/local storage to save and remember those. I am not so sure why we should remember them, do they change? According to the documentation they don’t change.

Hi guys, I’m with the same problem, I just did the update to the SDK41 and the warning of the installationId deprecation appeared, it would be desirable to have an official document on how to make a proper implementation for this, for now what can help us are these links :

good call! we should create something for this.

the basic steps are:

  1. install some persistence library (eg: async storage)
  2. install some library to generate uuids (eg: uuid)
  3. on app start, check if a uuid has been saved to storage. if so, read it and make it available somewhere convenient to use wherever you need it. if not, generate the uuid with and write it to storage, then make it available.

Simple, but not the best solution for Constants.installationId deprecation warning is the following:

import getInstallationIdAsync from 'expo/build/environment/getInstallationIdAsync';

yes, please!

I have updated to sdk 41 and I find the same problem and I don’t know how to solve it.

I think I will go for the same solution

Will there be a way to keep things backward-compatible / to keep using the existing installation IDs on iOS? We still need to keep the IDs for old users consistent. (I suppose we can just use the code from getInstallationIdAsync.js if we have to?)

1 Like

i got this problem, any help ?

I am afraid that the user will have more control over the value I store in AsyncStorage. He can hypothetically get access to someone else’s UUID (from their AsyncStorage) and act as that user by modifying it in his own storage.

Or maybe i’m just overthinking and you simply cant see or modify asyncStorage’s content with or without root.

Maybe use SecureStore - Expo Documentation

I got this error with expo-firebase-analytics. It seems that I should use setClientId to avoid this warning based on the official document.

By default, the clientId is set to Constants.installationId in Expo Go, which is deprecated and will be removed in SDK 44. At that time, you’ll need to use this method to set your own clientId when using Expo Go.

By taking IOS vendor id or ANDROID application id, it is possible to generate consistent installationId’s with uuid v5. However, these methods do not yield the same installationId with the current one from the expo-constants package, which is about to be deprecated. expo-constants package uses native code to generate installation ids. Therefore, one needs not to think that the function expo/build/environment/getInstallationIdAsync would yield the same installationIds as before. If you want to keep the same installationId’s, you should save the current installationIds to async/secure storage until it is deprecated in SDK 44. Then, you can start using a new generation algorithm for new installs, starting from SDK 44.

The function I implemented for installationId generation is below, for your convenience. It works for android and ios consistently (implemented in a similar way with getInstallationIdAsync from expo-application), and generate random ids each time for web.

There is a small chance that ios and android may not generate the same id all the time, so I recommend saving the result of this function to async/secure storage and keep using the value from storage from then on.

import { Platform } from 'react-native';
import * as Application from 'expo-application';
import {v5 as uuidv5} from 'uuid';

// used on web. you may need to use a polyfill for
// browsers that do not implement `crypto` interface (for example, IE < 11) 
// or, you can use uuid@3.4.0 , which falls back to Math.random()
import {v4 as uuidv4} from 'uuid'; 

const UUID_NAMESPACE = '29cc8a0d-747c-5f85-9ff9-f2f16636d963';

async function getInstallationIdManually() {
    let installationId;

    if(['android', 'ios'].includes(Platform.OS)) {
      let identifierForVendor;

      if(Platform.OS === 'android') {
        identifierForVendor = Application.androidId;
      } else { // ios
        identifierForVendor = await Application.getIosIdForVendorAsync();

      const bundleIdentifier = Application.applicationId;

      if (identifierForVendor) {
        installationId = uuidv5(`${bundleIdentifier}-${identifierForVendor}`, UUID_NAMESPACE);
      } else {
        const installationTime = await Application.getInstallationTimeAsync();
        installationId = uuidv5(`${bundleIdentifier}-${installationTime.getTime()}`, UUID_NAMESPACE);
    else { // WEB. random (uuid v4)
      installationId = uuidv4();

    return installationId;

nice solution, pretty clean

This is awesome. Do you have to install expo install expo-crypto? Or will npm i uuid just work?

hi, I am new to react native and expo. I am just confused about how to apply this solution to my project?
Do I need to modify any existing file or where I need to place this code?

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.