Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log("Device Name", DeviceInfo.getSystemName()); // e.g. iPhone OS
console.log("Device Version", DeviceInfo.getSystemVersion()); // e.g. 9.0
console.log("Bundle Id", DeviceInfo.getBundleId()); // e.g. com.learnium.mobile
console.log("Build Number", DeviceInfo.getBuildNumber()); // e.g. 89
console.log("App Version", DeviceInfo.getVersion()); // e.g. 1.1.0
console.log("App Version (Readable)", DeviceInfo.getReadableVersion()); // e.g. 1.1.0.89
console.log("Device Name", DeviceInfo.getDeviceName()); // e.g. Becca's iPhone 6
console.log("User Agent", DeviceInfo.getUserAgent()); // e.g. Dalvik/2.1.0 (Linux; U; Android 5.1; Google Nexus 4 - 5.1.0 - API 22 - 768x1280 Build/LMY47D)
const {navigator} = this.props;
storge.load({
key:'AppVersion',
autoSync:true,
}).then(ret =>{
version = ret.AppVersion;
console.log(JSON.stringify(version))
}).catch(err => {
// 如果没有找到数据且没有同步方法,
// 或者有其他异常,则在catch中返回
console.warn(err);
})
this.timer = setTimeout(()=> {
// An All Components Screen is a great way to dev and quick-test components
import React from 'react'
import { View, ScrollView, Text, Image, NetInfo, TouchableOpacity } from 'react-native'
import DeviceInfo from 'react-native-device-info'
import { Metrics, Images } from './DevTheme'
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()},
{title: 'App Version', info: DeviceInfo.getVersion()},
{title: 'App Version (Readable)', info: DeviceInfo.getReadableVersion()}
]
// An All Components Screen is a great way to dev and quick-test components
import React from 'react'
import { View, ScrollView, Text, Image, NetInfo, TouchableOpacity } from 'react-native'
import DeviceInfo from 'react-native-device-info'
import Reactotron from 'reactotron-react-native'
import { Metrics, Images } from './DevTheme'
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()},
{title: 'App Version', info: DeviceInfo.getVersion()},
{title: 'App Version (Readable)', info: DeviceInfo.getReadableVersion()}
]
export const LOGw = new Logger(LOG_LEVEL.warning);
export const LOGe = new Logger(LOG_LEVEL.error );
LOG.info("Device Manufacturer", DeviceInfo.getManufacturer()); // e.g. Apple
LOG.info("Device Brand", DeviceInfo.getBrand()); // e.g. Apple / htc / Xiaomi
LOG.info("Device Model", DeviceInfo.getModel()); // e.g. iPhone 6
LOG.info("Device ID", DeviceInfo.getDeviceId()); // e.g. iPhone7,2 / or the board on Android e.g. goldfish
LOG.info("System Name", DeviceInfo.getSystemName()); // e.g. iPhone OS
LOG.info("System Version", DeviceInfo.getSystemVersion()); // e.g. 9.0
LOG.info("Bundle ID", DeviceInfo.getBundleId()); // e.g. com.learnium.mobile
LOG.info("Build Number", DeviceInfo.getBuildNumber()); // e.g. 89
LOG.info("App Version", DeviceInfo.getVersion()); // e.g. 1.1.0
LOG.info("App Version (Readable)", DeviceInfo.getReadableVersion()); // e.g. 1.1.0.89
LOG.info("Device Name", DeviceInfo.getDeviceName()); // e.g. Becca's iPhone 6
LOG.info("User Agent", DeviceInfo.getUserAgent()); // e.g. Dalvik/2.1.0 (Linux; U; Android 5.1; Google Nexus 4 - 5.1.0 - API 22 - 768x1280 Build/LMY47D)
LOG.info("Device Locale", DeviceInfo.getDeviceLocale()); // e.g en-US
LOG.info("Device Country", DeviceInfo.getDeviceCountry()); // e.g US
LOG.info("App Instance ID", DeviceInfo.getInstanceID()); // ANDROID ONLY - see https://developers.google.com/instance-id/
initialize(trackerId,appName){
this.uniqueClientId = uniqClientId;
this.trackingAppName = appName;
this.currentRootScreen = '';
this.ga = new Analytics(trackerId, uniqClientId, 1, DeviceInfo.getUserAgent());
this.processPrematureHitsQueue();
const deviceName = DeviceInfo.getModel().toLocaleLowerCase() !== 'iphone'
? DeviceInfo.getModel() : DeviceInfo.getDeviceId();
console.log('analytics detected deviceName:',deviceName, 'uid:', uniqClientId);
this.addSessionDimension(4, deviceName);
},
addSessionDimension(index,value){
formData.append('element_1', feedback.comment)
formData.append('element_2', feedback.name)
formData.append('element_3', feedback.email)
formData.append(
'element_4',
'Device Manufacturer: ' + Device.getManufacturer() + '\n' +
'Device Brand: ' + Device.getBrand() + '\n' +
'Device Model: ' + Device.getModel() + '\n' +
'Device ID: ' + Device.getDeviceId() + '\n' +
'System Name: ' + Device.getSystemName() + '\n' +
'System Version: ' + Device.getSystemVersion() + '\n' +
'Bundle ID: ' + Device.getBundleId() + '\n' +
'App Version: ' + Device.getVersion() + '\n' +
'Build Number: ' + Device.getBuildNumber() + '\n' +
'Device Name: ' + Device.getDeviceName() + '\n' +
'User Agent: ' + Device.getUserAgent() + '\n' +
'Device Locale: ' + Device.getDeviceLocale() + '\n' +
'Device Country: ' + Device.getDeviceCountry() + '\n' +
'Timezone: ' + Device.getTimezone()
)
formData.append('form_id','175631')
formData.append('submit_form','1')
formData.append('page_number','1')
formData.append('submit_form','Submit')
return fetch(FEEDBACK_URL, {
method: 'POST',
body: formData
})
.then(response => (response))
.catch(error => (error))
}
componentDidMount() {
Client4.setUserAgent(DeviceInfo.getUserAgent());
if (store.getState().views.root.hydrationComplete) {
this.handleHydrationComplete();
} else {
this.unsubscribeFromStore = store.subscribe(this.listenForHydration);
}
}
render() {
return (
);
}
}