Skip to content

Instantly share code, notes, and snippets.

@lrohde
Created September 16, 2019 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrohde/47b221382ad5b09f3b8187123ab13b17 to your computer and use it in GitHub Desktop.
Save lrohde/47b221382ad5b09f3b8187123ab13b17 to your computer and use it in GitHub Desktop.
DeviceInfo.getApplicationName().then(appName => {
// AwesomeApp
});
DeviceInfo.getBaseOs().then(baseOs => {
// "Windows", "Android" etc
});
DeviceInfo.getBatteryLevel().then(batteryLevel => {
// 0.759999
});
DeviceInfo.getBuildId().then(buildId => {
// iOS: "12A269"
// tvOS: not available
// Android: "13D15"
// Windows: not available
});
DeviceInfo.getBuildNumber().then(buildNumber => {
// iOS: "89"
// Android: "4"
// Windows: ?
});
DeviceInfo.getBundleId().then(bundleId => {
// "com.example.AwesomeApp"v
});
DeviceInfo.getAvailableLocationProviders().then(providers => {
// {
// gps: true
// network: true
// passive: true
// }
});
DeviceInfo.getBrand().then(brand => {
// iOS: "Apple"
// Android: "xiaomi"
// Windows: ?
});
DeviceInfo.getCarrier().then(carrier => {
// "SOFTBANK"
});
DeviceInfo.getDeviceId().then(deviceId => {
// iOS: "iPhone7,2"
// Android: "goldfish"
// Windows: ?
});
DeviceInfo.getDeviceType().then(type => {
// Handset
// Tablet
// Tv
// Unknown
});
DeviceInfo.getDeviceName().then(deviceName => {
// iOS: "Becca's iPhone 6"
// Android: ?
// Windows: ?
});
DeviceInfo.getFontScale().then(fontScale => {
// 1.2
});
DeviceInfo.getFreeDiskStorage().then(freeDiskStorage => {
// Android: 17179869184
// iOS: 17179869184
});
DeviceInfo.getIpAddress().then(ip => {
// "92.168.32.44"
});
DeviceInfo.getMacAddress().then(mac => {
// "E5:12:D8:E5:69:97"
});
DeviceInfo.getManufacturer().then(manufacturer => {
// iOS: "Apple"
// Android: "Google"
// Windows: ?
});
DeviceInfo.getModel().then(model => {
// iOS: ?
// Android: ?
// Windows: ?
});
/* This option works only on Android */
DeviceInfo.getPhoneNumber().then(phoneNumber => {
// Android: null return: no permission, empty string: unprogrammed or empty SIM1, e.g. "+15555215558": normal return value
});
DeviceInfo.getPowerState().then(state => {
// {
// batteryLevel: 0.759999,
// batteryState: 'unplugged',
// lowPowerMode: false,
// }
});
DeviceInfo.getReadableVersion().then(readableVersion => {
// iOS: 1.0.1.32
// Android: 1.0.1.234
// Windows: ?
});
DeviceInfo.getSystemName().then(systemName => {
// iOS: "iOS" on newer iOS devices "iPhone OS" on older devices, including older iPad's.
// Android: "Android"
// Windows: ?
});
DeviceInfo.getSystemVersion().then(systemVersion => {
// iOS: "11.0"
// Android: "7.1.1"
// Windows: ?
});
DeviceInfo.getTotalDiskCapacity().then(capacity => {
// Android: 17179869184
// iOS: 17179869184
});
DeviceInfo.getTotalMemory().then(totalMemory => {
// 1995018240
});
DeviceInfo.getUniqueId().then(uniqueId => {
// iOS: "FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9"
// Android: "dd96dec43fb81c97"
// Windows: ?
});
DeviceInfo.getUsedMemory().then(usedMemory => {
// 23452345
});
DeviceInfo.getUserAgent().then(userAgent => {
// iOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143"
// tvOS: not available
// Android: ?
// Windows: ?
});
DeviceInfo.getVersion().then(version => {
// iOS: "1.0"
// Android: "1.0"
// Windows: ?
});
DeviceInfo.hasNotch().then(hasNotch => {
// true
});
DeviceInfo.isBatteryCharging().then(isCharging => {
// true or false
});
DeviceInfo.isEmulator().then(isEmulator => {
// false
});
DeviceInfo.isLandscape().then(isLandscape => {
// true
});
DeviceInfo.isLocationEnabled().then(enabled => {
// true or false
});
// Tells if a PIN number or a fingerprint was set for the device.
DeviceInfo.isPinOrFingerprintSet().then(isPinOrFingerprintSet => {
if (!isPinOrFingerprintSet) {
// ...
}
});
DeviceInfo.isTablet().then(isTablet => {
// true
});
DeviceInfo.supportedAbis().then(abis => {
// [ "arm64 v8", "Intel x86-64h Haswell", "arm64-v8a", "armeabi-v7a", "armeabi" ]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment