import * as Application from 'expo-application'; import { Platform } from 'react-native'; import { v4 as uuidv4 } from 'uuid'; async function generate(): Promise { let deviceId: string | null = null; try { if (Platform.OS === 'ios') { deviceId = await Application.getIosIdForVendorAsync(); } else if (Platform.OS === 'android') { deviceId = Application.getAndroidId(); } } catch (error) { // eslint-disable-next-line no-console console.warn('Failed to get native device ID:', error); } return deviceId || uuidv4(); } export const deviceIdUtils = { generate, };