How to use the react-native-device-info.getUniqueID function in react-native-device-info

To help you get started, we’ve selected a few react-native-device-info examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github infinitered / ignite / ignite-base / App / Containers / DeviceInfoScreen.js View on Github external
// @flow

// An All Components Screen is a great way to dev and quick-test components
import React from 'react'
import { View, ScrollView, Text, Image, NetInfo } from 'react-native'
import DeviceInfo from 'react-native-device-info'
import { Metrics, Images } from '../Themes'
import styles from './Styles/DeviceInfoScreenStyles'

const HARDWARE_DATA = [
  {title: 'Device Manufacturer', info: DeviceInfo.getManufacturer()},
  {title: 'Device Name', info: DeviceInfo.getDeviceName()},
  {title: 'Device Model', info: DeviceInfo.getModel()},
  {title: 'Device Unique ID', info: DeviceInfo.getUniqueID()},
  {title: 'Device Locale', info: DeviceInfo.getDeviceLocale()},
  {title: 'Device Country', info: DeviceInfo.getDeviceCountry()},
  {title: 'User Agent', info: DeviceInfo.getUserAgent()},
  {title: 'Screen Width', info: Metrics.screenWidth},
  {title: 'Screen Height', info: Metrics.screenHeight}
]

const OS_DATA = [
  {title: 'Device System Name', info: DeviceInfo.getSystemName()},
  {title: 'Device ID', info: DeviceInfo.getDeviceId()},
  {title: 'Device Version', info: DeviceInfo.getSystemVersion()}
]

const APP_DATA = [
  {title: 'Bundle Id', info: DeviceInfo.getBundleId()},
  {title: 'Build Number', info: DeviceInfo.getBuildNumber()},
github Osedea / react-native-offline-first-example / js / index.js View on Github external
componentWillMount() {
        const user = { uuid: DeviceInfo.getUniqueID() };

        if (!store.getState().user.data) {
            store.dispatch(setLocalUser(user));
        }

        store.dispatch(getAndSetUser(user));
        // Retry Images if some are pending
        store.dispatch(retryImages(selectPendingImages()(store.getState())));
    }
github EdgeApp / edge-react-gui / src / components / Main.ui.js View on Github external
componentDidMount () {
    const id = DeviceInfo.getUniqueID()
    global.firebase && global.firebase.analytics().setUserId(id)
    global.firebase && global.firebase.analytics().logEvent(`Start_App`)
    makeCoreContext(pluginFactories).then(context => {
      const folder = makeReactNativeFolder()

      // Put the context into Redux:
      this.props.addContext(context, folder)

      CONTEXT_API.listUsernames(context).then(usernames => {
        this.props.addUsernames(usernames)
        queryUtilServer(context, folder, usernames)
      })
      setIntlLocale(localeInfo)
      selectLocale(DeviceInfo.getDeviceLocale())
      SplashScreen.close({
        animationType: SplashScreen.animationType.fade,
github celo-org / celo-monorepo / packages / mobile / src / geth / geth.ts View on Github external
async function uploadLogs(gethLogFilePath: string, reactNativeLogFilePath: string) {
  Logger.debug('Geth@uploadLogs', 'Attempting to upload geth logs')
  try {
    const bundleId = DeviceInfo.getBundleId()
    const uploadPath = `${bundleId}/${DEFAULT_TESTNET}`

    // Phone number might not be verified here but that does not matter for logging.
    const phoneNumber = (await DeviceInfo.getPhoneNumber()) || 'unknown'
    const timestamp = new Date().getTime()
    const deviceId = DeviceInfo.getUniqueID()
    const uploadId = `${timestamp}_${deviceId}`
    const gethUploadFileName = `${phoneNumber}_${uploadId}_geth.txt`
    const reactNativeUploadFileName = `${phoneNumber}_${uploadId}_rn.txt`
    // Upload one if the other one is uploaded.

    const [shouldUploadGeth, shouldUploadRN] = await Promise.all([
      FirebaseLogUploader.shouldUpload(gethLogFilePath, UPLOAD_SIZE_THRESHOLD, true),
      FirebaseLogUploader.shouldUpload(reactNativeLogFilePath, UPLOAD_SIZE_THRESHOLD, true),
    ])

    // If either of them have to be uploaded then upload both.
    // Noth that the Wi-Fi can switch to cellular between the time of check and
    // the time of use but at this time that's an acceptable tradeoff.
    if (shouldUploadGeth || shouldUploadRN) {
      await Promise.all([
        FirebaseLogUploader.upload(gethLogFilePath, uploadPath, gethUploadFileName),
github brandingbrand / flagship / packages / fsengagement / src / EngagementService.ts View on Github external
setPushToken(pushToken: string): void {
    const device = this.profileData && this.profileData.devices &&
      this.profileData.devices[DeviceInfo.getUniqueID()];
    if (device) {
      if (!device.pushToken || device.pushToken !== pushToken) {
        this.networkClient
          .patch(`/Devices/${device.id}`, { pushToken })
          .catch((e: any) => console.log('failed to set push token', e));
      }
    }
  }
github innFactory / react-native-aws-mobile-analytics / src / MobileAnalyticsClient.js View on Github external
initStorage(callback) {
        this.storage.setLogger(this.logger);

        this.storage.set(
            StorageKeys.GLOBAL_ATTRIBUTES,
            Util.mergeObjects(this.options.globalAttributes,
                this.storage.get(StorageKeys.GLOBAL_ATTRIBUTES) || {})
        );
        this.storage.set(
            StorageKeys.GLOBAL_METRICS,
            Util.mergeObjects(this.options.globalMetrics,
                this.storage.get(StorageKeys.GLOBAL_METRICS) || {})
        );

        this.storage.set(StorageKeys.CLIENT_ID, DeviceInfo.getUniqueID());

        this.StorageKeys = {
            'EVENTS'     : 'AWSMobileAnalyticsEventStorage',
            'BATCHES'    : 'AWSMobileAnalyticsBatchStorage',
            'BATCH_INDEX': 'AWSMobileAnalyticsBatchIndexStorage'
        };

        this.outputs = {};
        this.outputs.MobileAnalytics = new AWS.MobileAnalytics(this.options.clientOptions);
        this.outputs.timeoutReference = null;
        this.outputs.batchesInFlight = {};

        this.outputs.events = this.storage.get(this.StorageKeys.EVENTS) || [];
        this.outputs.batches = this.storage.get(this.StorageKeys.BATCHES) || {};
        this.outputs.batchIndex = this.storage.get(this.StorageKeys.BATCH_INDEX) || [];
github oney / iTunesConnect / src / utils / GAManager.js View on Github external
constructor() {
    if (__DEV__) {
      return
    }
    let clientId = DeviceInfo.getUniqueID()
    this.ga = new Analytics(GA_ID, clientId)
  }
  sendScreenView(name) {
github futurice / wappuapp-client / app / actions / registration.js View on Github external
return (dispatch, getStore) => {
    dispatch({ type: CREATE_USER_REQUEST });
    const uuid = DeviceInfo.getUniqueID();
    const name = getStore().registration.get('name');
    const team = getStore().registration.get('selectedTeam');
    return api.putUser({ uuid, name, team })
      .then(response => {
        dispatch({ type: CREATE_USER_SUCCESS });
        dispatch({ type: CLOSE_REGISTRATION_VIEW });
      })
      .catch(error => dispatch({ type: CREATE_USER_FAILURE, error: error }));
  };
};
github futurice / wappuapp-client / app / actions / registration.js View on Github external
return dispatch => {
    dispatch({ type: GET_USER_REQUEST });
    const uuid = DeviceInfo.getUniqueID();
    return api.getUser(uuid)
      .then(user => {
        dispatch({ type: GET_USER_SUCCESS, payload: user });
      })
      .catch(error => {
        dispatch({ type: GET_USER_FAILURE, error: error });
      });
  };
};
github futurice / wappuapp-client / app / concepts / registration.js View on Github external
export const postProfilePicture = imageData => (dispatch, getState) => {
  if (!imageData) {
    return;
  }

  dispatch({ type: POST_PROFILE_PICTURE_REQUEST });

  const name = getUserName(getState());
  const team = getUserTeamId(getState());
  const uuid = DeviceInfo.getUniqueID();

  return api
    .putUser({ uuid, name, team, imageData })
    .then(response => {
      Promise.resolve(dispatch(getUser())).then(() => {
        dispatch({ type: POST_PROFILE_PICTURE_SUCCESS });
      });
    })
    .catch(error => dispatch({ type: POST_PROFILE_PICTURE_FAILURE, error: error }));
};