New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-device-info

Package Overview
Dependencies
Maintainers
5
Versions
257
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-device-info - npm Package Compare versions

Comparing version 3.0.0-rc.1 to 3.0.0-rc.2

9

CHANGELOG.md
<!-- markdownlint-disable MD024 MD034 MD033 -->
# Release Notes
## 3.0.0-rc.2
* Added a sync version of each API call, in practice it is very difficult to consume async
APIs during app bootstrap and device info is frequently fundamental to app startup behavior.
This still preserves the change away from paying the entire cost of information retrieval at
startup - now you will only pay for exactly what you need.
## 3.0.0-rc.1

@@ -14,2 +21,4 @@

* BREAKING CHANGE: more return value changes to standardize return values (see below)
* feat: you no longer have to be careful with platform-specific APIs, all APIs will work, just
returning standard "unknown" return values (see above breaking change, and example App.js usage)

@@ -16,0 +25,0 @@ ## 3.0.0-beta.2

186

deviceinfo.d.ts

@@ -20,68 +20,130 @@ // should be imported this way:

declare const _default: {
getUniqueId: () => Promise<string>;
getManufacturer: () => Promise<string>;
getBrand: () => Promise<string>;
getModel: () => Promise<string>;
getDeviceId: () => Promise<string>;
getSystemName: () => Promise<string>;
getSystemVersion: () => Promise<string>;
getBuildId: () => Promise<string>;
getBundleId: () => Promise<string>;
getApplicationName: () => Promise<string>;
getBuildNumber: () => Promise<string>;
getVersion: () => Promise<string>;
getReadableVersion: () => Promise<string>;
getDeviceName: () => Promise<string>;
getUsedMemory: () => Promise<number>;
getUserAgent: () => Promise<string>;
getInstanceId: () => Promise<string>;
getUniqueId: () => Promise<string>,
getUniqueIdSync: () => string,
getManufacturer: () => Promise<string>,
getManufacturerSync: () => string,
getBrand: () => Promise<string>,
getBrandSync: () => string,
getModel: () => Promise<string>,
getModelSync: () => string,
getDeviceId: () => Promise<string>,
getDeviceIdSync: () => string,
getSystemName: () => Promise<string>,
getSystemNameSync: () => string,
getSystemVersion: () => Promise<string>,
getSystemVersionSync: () => string,
getBuildId: () => Promise<string>,
getBuildIdSync: () => string,
getBundleId: () => Promise<string>,
getBundleIdSync: () => string,
getApplicationName: () => Promise<string>,
getApplicationNameSync: () => string,
getBuildNumber: () => Promise<string>,
getBuildNumberSync: () => string,
getVersion: () => Promise<string>,
getVersionSync: () => string,
getReadableVersion: () => Promise<string>,
getReadableVersionSync: () => string,
getDeviceName: () => Promise<string>,
getDeviceNameSync: () => string,
getUsedMemory: () => Promise<number>,
getUsedMemorySync: () => number,
getUserAgent: () => Promise<string>,
getUserAgentSync: () => string,
getInstanceId: () => Promise<string>,
getInstanceIdSync: () => string,
getInstallReferrer: () => string | null;
isEmulator: () => Promise<boolean>;
isTablet: () => Promise<boolean>;
getFontScale: () => Promise<number>;
getBootloader: () => Promise<string>;
getDevice: () => Promise<string>;
getDisplay: () => Promise<string>;
getFingerprint: () => Promise<string>;
getHardware: () => Promise<string>;
getHost: () => Promise<string>;
getProduct: () => Promise<string>;
getTags: () => Promise<string>;
getType: () => Promise<string>;
getBaseOs: () => Promise<string>;
getPreviewSdkInt: () => Promise<number>;
getSecurityPatch: () => Promise<string>;
getCodename: () => Promise<string>;
getIncremental: () => Promise<string>;
isPinOrFingerprintSet(): () => Promise<boolean>
hasNotch: () => Promise<boolean>;
getFirstInstallTime: () => Promise<number>;
getLastUpdateTime: () => Promise<number>;
getSerialNumber: () => Promise<string>;
getAndroidId: () => Promise<string>;
getIpAddress: () => Promise<string>;
getCameraPresence: () => Promise<boolean>;
getMacAddress: () => Promise<string>;
isEmulator: () => Promise<boolean>,
isEmulatorSync: () => boolean,
isTablet: () => Promise<boolean>,
isTabletSync: () => boolean,
getFontScale: () => Promise<number>,
getFontScaleSync: () => number,
getBootloader: () => Promise<string>,
getBootloaderSync: () => string,
getDevice: () => Promise<string>,
getDeviceSync: () => string,
getDisplay: () => Promise<string>,
getDisplaySync: () => string,
getFingerprint: () => Promise<string>,
getFingerprintSync: () => string,
getHardware: () => Promise<string>,
getHardwareSync: () => string,
getHost: () => Promise<string>,
getHostSync: () => string,
getProduct: () => Promise<string>,
getProductSync: () => string,
getTags: () => Promise<string>,
getTagsSync: () => string,
getType: () => Promise<string>,
getTypeSync: () => string,
getBaseOs: () => Promise<string>,
getBaseOsSync: () => string,
getPreviewSdkInt: () => Promise<number>,
getPreviewSdkIntSync: () => number,
getSecurityPatch: () => Promise<string>,
getSecurityPatchSync: () => string,
getCodename: () => Promise<string>,
getCodenameSync: () => string,
getIncremental: () => Promise<string>,
getIncrementalSync: () => string,
isPinOrFingerprintSet: () => Promise<boolean>,
isPinOrFingerprintSetSync: () => boolean,
hasNotch: () => Promise<boolean>,
hasNotchSync: () => boolean,
getFirstInstallTime: () => Promise<number>,
getFirstInstallTimeSync: () => number,
getLastUpdateTime: () => Promise<number>,
getLastUpdateTimeSync: () => number,
getSerialNumber: () => Promise<string>,
getSerialNumberSync: () => string,
getAndroidId: () => Promise<string>,
getAndroidIdSync: () => string,
getApiLevel: () => Promise<number>,
getApiLevelSync: () => number,
getIpAddress: () => Promise<string>,
getIpAddressSync: () => string,
getCameraPresence: () => Promise<boolean>,
getCameraPresenceSync: () => boolean,
getMacAddress: () => Promise<string>,
getMacAddressSync: () => string,
getPhoneNumber: () => Promise<string>;
getApiLevel: () => Promise<number>;
getCarrier: () => Promise<string>;
getTotalMemory: () => Promise<number>;
getMaxMemory: () => Promise<number>;
getTotalDiskCapacity: () => Promise<number>;
getFreeDiskStorage: () => Promise<number>;
getBatteryLevel: () => Promise<number>;
getPowerState: () => Promise<PowerState>;
isBatteryCharging: () => Promise<boolean>;
isLandscape: () => Promise<boolean>;
isAirplaneMode: () => Promise<boolean>;
getDeviceType: () => Promise<DeviceType>;
supportedAbis: () => Promise<string[]>;
supported32BitAbis: () => Promise<string[]>;
supported64BitAbis: () => Promise<string[]>;
hasSystemFeature: (feature: string) => Promise<boolean>;
getSystemAvailableFeatures: () => Promise<string[]>;
isLocationEnabled: () => Promise<boolean>;
getAvailableLocationProviders: () => Promise<LocationProviderInfo>;
getCarrier: () => Promise<string>,
getCarrierSync: () => string,
getTotalMemory: () => Promise<number>,
getTotalMemorySync: () => number,
getMaxMemory: () => Promise<number>,
getMaxMemorySync: () => number,
getTotalDiskCapacity: () => Promise<number>,
getTotalDiskCapacitySync: () => number,
getFreeDiskStorage: () => Promise<number>,
getFreeDiskStorageSync: () => number,
getBatteryLevel: () => Promise<number>,
getBatteryLevelSync: () => number,
getPowerState: () => Promise<Object>,
getPowerStateSync: () => Object,
isBatteryCharging:() => Promise<boolean>,
isBatteryChargingSync: () => boolean,
isLandscape: () => Promise<boolean>,
isLandscapeSync: () => boolean,
isAirplaneMode: () => Promise<boolean>,
isAirplaneModeSync: () => boolean,
getDeviceType: () => Promise<DeviceType>,
getDeviceTypeSync: () => DeviceType,
supportedAbis: () => Promise<string[]>,
supportedAbisSync: () => string[],
supported32BitAbis: () => Promise<string[]>,
supported32BitAbisSync: () => string[],
supported64BitAbis: () => Promise<string[]>,
supported64BitAbisSync: () => string[],
hasSystemFeature: (feature: string) => Promise<boolean>,
hasSystemFeatureSync: (feature: string) => boolean,
getSystemAvailableFeatures: () => Promise<string[]>,
getSystemAvailableFeaturesSync: () => string[],
isLocationEnabled: () => Promise<boolean>,
isLocationEnabledSync: () => boolean,
getAvailableLocationProviders: () => Promise<LocationProviderInfo>,
getAvailableLocationProvidersSync: () => LocationProviderInfo,
};
export default _default;

@@ -356,2 +356,9 @@ /**

export function getUniqueIdSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getUniqueIdSync();
}
return 'unknown';
}
export async function getInstanceId() {

@@ -365,2 +372,10 @@ if (OS === 'android') {

export function getInstanceIdSync() {
if (OS === 'android') {
return RNDeviceInfo.getInstanceIdSync();
} else {
return 'unknown';
}
}
export async function getSerialNumber() {

@@ -373,2 +388,9 @@ if (OS === 'android') {

export function getSerialNumberSync() {
if (OS === 'android') {
return RNDeviceInfo.getSerialNumberSync();
}
return 'unknown';
}
export async function getAndroidId() {

@@ -381,2 +403,9 @@ if (OS === 'android') {

export function getAndroidIdSync() {
if (OS === 'android') {
return RNDeviceInfo.getAndroidIdSync();
}
return 'unknown';
}
export async function getIpAddress() {

@@ -389,2 +418,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getIpAddressSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getIpAddressSync();
}
return 'unknown';
}
export async function getCameraPresence() {

@@ -397,9 +433,29 @@ if (OS === 'android' || OS === 'windows') {

export function getCameraPresenceSync() {
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getCameraPresenceSync();
}
return false;
}
export async function getMacAddress() {
if (OS === 'android' || OS === 'ios') {
if (OS === 'android') {
return RNDeviceInfo.getMacAddress();
}
if (OS === 'ios') {
return '02:00:00:00:00:00';
}
return Promise.resolve('unknown');
}
export function getMacAddressSync() {
if (OS === 'android') {
return RNDeviceInfo.getMacAddressSync();
}
if (OS === 'ios') {
return '02:00:00:00:00:00';
}
return 'unknown';
}
export async function getDeviceId() {

@@ -412,9 +468,29 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getDeviceIdSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getDeviceIdSync();
}
return 'unknown';
}
export async function getManufacturer() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getSystemManufacturer();
}
if (OS === 'ios') {
return 'Apple';
}
return Promise.resolve('unknown');
}
export function getManufacturerSync() {
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getSystemManufacturerSync();
}
if (OS === 'ios') {
return 'Apple';
}
return Promise.resolve('unknown');
}
export async function getModel() {

@@ -447,16 +523,75 @@ if (OS === 'ios') {

export function getModelSync() {
if (OS === 'ios') {
var deviceName;
var deviceId = RNDeviceInfo.getDeviceIdSync();
if (deviceId) {
deviceName = deviceNamesByCode[deviceId];
if (!deviceName) {
// Not found on database. At least guess main device type from string contents:
if (deviceId.startsWith('iPod')) {
deviceName = 'iPod Touch';
} else if (deviceId.startsWith('iPad')) {
deviceName = 'iPad';
} else if (deviceId.startsWith('iPhone')) {
deviceName = 'iPhone';
} else if (deviceId.startsWith('AppleTV')) {
deviceName = 'Apple TV';
}
}
}
return deviceName;
}
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getModelSync();
}
return 'unknown';
}
export async function getBrand() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getBrand();
}
if (OS === 'ios') {
return 'Apple';
}
return Promise.resolve('unknown');
}
export function getBrandSync() {
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getBrandSync();
}
if (OS === 'ios') {
return 'Apple';
}
return 'unknown';
}
export async function getSystemName() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
if (OS === 'ios') {
return RNDeviceInfo.getSystemName();
}
if (OS === 'android') {
return 'Android';
}
if (OS === 'windows') {
return 'Windows';
}
return Promise.resolve('unknown');
}
export function getSystemNameSync() {
if (OS === 'ios') {
return RNDeviceInfo.getSystemNameSync();
}
if (OS === 'android') {
return 'Android';
}
if (OS === 'windows') {
return 'Windows';
}
return 'unknown';
}
export async function getSystemVersion() {

@@ -469,2 +604,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getSystemVersionSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getSystemVersionSync();
}
return 'unknown';
}
export async function getBuildId() {

@@ -477,2 +619,9 @@ if (OS === 'android' || OS === 'ios') {

export function getBuildIdSync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.getBuildIdSync();
}
return 'unknown';
}
export async function getApiLevel() {

@@ -485,2 +634,9 @@ if (OS === 'android') {

export function getApiLevelSync() {
if (OS === 'android') {
return RNDeviceInfo.getApiLevelSync();
}
return -1;
}
export async function getBundleId() {

@@ -493,2 +649,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getBundleIdSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getBundleIdSync();
}
return 'unknown';
}
export async function getApplicationName() {

@@ -501,2 +664,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getApplicationNameSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getAppNameSync();
}
return 'unknown';
}
export async function getBuildNumber() {

@@ -509,2 +679,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getBuildNumberSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getBuildNumberSync();
}
return 'unknown';
}
export async function getVersion() {

@@ -517,2 +694,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getVersionSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getAppVersionSync();
}
return 'unknown';
}
export async function getReadableVersion() {

@@ -522,2 +706,6 @@ return (await RNDeviceInfo.getAppVersion()) + '.' + (await RNDeviceInfo.getBuildNumber());

export function getReadableVersionSync() {
return RNDeviceInfo.getAppVersionSync() + '.' + RNDeviceInfo.getBuildNumberSync();
}
export async function getDeviceName() {

@@ -530,2 +718,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getDeviceNameSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getDeviceNameSync();
}
return 'unknown';
}
export async function getUsedMemory() {

@@ -538,2 +733,9 @@ if (OS === 'android' || OS === 'ios') {

export function getUsedMemorySync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.getUsedMemorySync();
}
return -1;
}
export async function getUserAgent() {

@@ -546,2 +748,6 @@ if (OS === 'android' || OS === 'ios' || OS === 'web') {

export function getUserAgentSync() {
throw new Error('getUserAgent is only available async');
}
export async function getFontScale() {

@@ -554,2 +760,9 @@ if (OS === 'android' || OS === 'ios') {

export function getFontScaleSync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.getFontScaleSync();
}
return 'unknown';
}
export async function getBootloader() {

@@ -562,2 +775,9 @@ if (OS === 'android') {

export function getBootloaderSync() {
if (OS === 'android') {
return RNDeviceInfo.getBootloaderSync();
}
return 'unknown';
}
export async function getDevice() {

@@ -570,2 +790,9 @@ if (OS === 'android') {

export function getDeviceSync() {
if (OS === 'android') {
return RNDeviceInfo.getDeviceSync();
}
return 'unknown';
}
export async function getDisplay() {

@@ -578,2 +805,9 @@ if (OS === 'android') {

export function getDisplaySync() {
if (OS === 'android') {
return RNDeviceInfo.getDisplaySync();
}
return 'unknown';
}
export async function getFingerprint() {

@@ -586,2 +820,9 @@ if (OS === 'android') {

export function getFingerprintSync() {
if (OS === 'android') {
return RNDeviceInfo.getFingerprintSync();
}
return 'unknown';
}
export async function getHardware() {

@@ -594,2 +835,9 @@ if (OS === 'android') {

export function getHardwareSync() {
if (OS === 'android') {
return RNDeviceInfo.getHardwareSync();
}
return 'unknown';
}
export async function getHost() {

@@ -602,2 +850,9 @@ if (OS === 'android') {

export function getHostSync() {
if (OS === 'android') {
return RNDeviceInfo.getHostSync();
}
return 'unknown';
}
export async function getProduct() {

@@ -610,2 +865,9 @@ if (OS === 'android') {

export function getProductSync() {
if (OS === 'android') {
return RNDeviceInfo.getProductSync();
}
return 'unknown';
}
export async function getTags() {

@@ -618,2 +880,9 @@ if (OS === 'android') {

export function getTagsSync() {
if (OS === 'android') {
return RNDeviceInfo.getTagsSync();
}
return 'unknown';
}
export async function getType() {

@@ -626,2 +895,9 @@ if (OS === 'android') {

export function getTypeSync() {
if (OS === 'android') {
return RNDeviceInfo.getTypeSync();
}
return 'unknown';
}
export async function getBaseOs() {

@@ -634,2 +910,9 @@ if (OS === 'android') {

export function getBaseOsSync() {
if (OS === 'android') {
return RNDeviceInfo.getBaseOsSync();
}
return 'unknown';
}
export async function getPreviewSdkInt() {

@@ -642,2 +925,9 @@ if (OS === 'android') {

export function getPreviewSdkIntSync() {
if (OS === 'android') {
return RNDeviceInfo.getPreviewSdkIntSync();
}
return 'unknown';
}
export async function getSecurityPatch() {

@@ -650,2 +940,9 @@ if (OS === 'android') {

export function getSecurityPatchSync() {
if (OS === 'android') {
return RNDeviceInfo.getSecurityPatchSync();
}
return 'unknown';
}
export async function getCodename() {

@@ -658,2 +955,9 @@ if (OS === 'android') {

export function getCodenameSync() {
if (OS === 'android') {
return RNDeviceInfo.getCodenameSync();
}
return 'unknown';
}
export async function getIncremental() {

@@ -666,2 +970,9 @@ if (OS === 'android') {

export function getIncrementalSync() {
if (OS === 'android') {
return RNDeviceInfo.getIncrementalSync();
}
return 'unknown';
}
export async function isEmulator() {

@@ -674,2 +985,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function isEmulatorSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.isEmulatorSync();
}
return false;
}
export async function isTablet() {

@@ -682,2 +1000,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function isTabletSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.isTabletSync();
}
return false;
}
export async function isPinOrFingerprintSet() {

@@ -690,4 +1015,11 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function isPinOrFingerprintSetSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.isPinOrFingerprintSetSync();
}
return false;
}
export async function hasNotch() {
let brand = await RNDeviceInfo.getBrand();
let brand = await getBrand();
let model = await getModel();

@@ -703,2 +1035,14 @@ return (

export function hasNotchSync() {
let brand = getBrandSync();
let model = getModelSync();
return (
devicesWithNotch.findIndex(
item =>
item.brand.toLowerCase() === brand.toLowerCase() &&
item.model.toLowerCase() === model.toLowerCase()
) !== -1
);
}
export async function getFirstInstallTime() {

@@ -711,2 +1055,9 @@ if (OS === 'android' || OS === 'windows') {

export function getFirstInstallTimeSync() {
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getFirstInstallTimeSync();
}
return -1;
}
export async function getInstallReferrer() {

@@ -719,2 +1070,9 @@ if (OS === 'android') {

export function getInstallReferrerSync() {
if (OS === 'android') {
return RNDeviceInfo.getInstallReferrerSync();
}
return 'unknown';
}
export async function getLastUpdateTime() {

@@ -727,2 +1085,9 @@ if (OS === 'android') {

export function getLastUpdateTimeSync() {
if (OS === 'android') {
return RNDeviceInfo.getLastUpdateTimeSync();
}
return -1;
}
export async function getPhoneNumber() {

@@ -735,2 +1100,9 @@ if (OS === 'android') {

export function getPhoneNumberSync() {
if (OS === 'android') {
return RNDeviceInfo.getPhoneNumberSync();
}
return 'unknown';
}
export async function getCarrier() {

@@ -743,2 +1115,9 @@ if (OS === 'android' || OS === 'ios') {

export function getCarrierSync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.getCarrierSync();
}
return 'unknown';
}
export async function getTotalMemory() {

@@ -751,2 +1130,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getTotalMemorySync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getTotalMemorySync();
}
return -1;
}
export async function getMaxMemory() {

@@ -759,2 +1145,9 @@ if (OS === 'android' || OS === 'windows') {

export function getMaxMemorySync() {
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getMaxMemorySync();
}
return -1;
}
export async function getTotalDiskCapacity() {

@@ -767,2 +1160,9 @@ if (OS === 'android' || OS === 'ios') {

export function getTotalDiskCapacitySync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.getTotalDiskCapacitySync();
}
return -1;
}
export async function getFreeDiskStorage() {

@@ -775,2 +1175,9 @@ if (OS === 'android' || OS === 'ios') {

export function getFreeDiskStorageSync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.getFreeDiskStorageSync();
}
return -1;
}
export async function getBatteryLevel() {

@@ -783,2 +1190,9 @@ if (OS === 'android' || OS === 'ios' || OS === 'windows') {

export function getBatteryLevelSync() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getBatteryLevelSync();
}
return -1;
}
export async function getPowerState() {

@@ -791,2 +1205,9 @@ if (OS === 'ios') {

export function getPowerStateSync() {
if (OS === 'ios') {
return RNDeviceInfo.getPowerStateSync();
}
return {};
}
export async function isBatteryCharging() {

@@ -799,3 +1220,14 @@ if (OS === 'android' || OS === 'ios') {

export function isBatteryChargingSync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.isBatteryChargingSync();
}
return false;
}
export async function isLandscape() {
return Promise.resolve(isLandscapeSync());
}
export function isLandscapeSync() {
const { height, width } = Dimensions.get('window');

@@ -812,2 +1244,9 @@ return width >= height;

export function isAirplaneModeSync() {
if (OS === 'android') {
return RNDeviceInfo.isAirplaneModeSync();
}
return false;
}
export async function getDeviceType() {

@@ -820,2 +1259,9 @@ if (OS === 'android' || OS === 'ios') {

export function getDeviceTypeSync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.getDeviceTypeSync();
}
return 'unknown';
}
export async function supportedAbis() {

@@ -828,2 +1274,9 @@ if (OS === 'android' || OS === 'ios') {

export function supportedAbisSync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.getSupportedAbisSync();
}
return [];
}
export async function supported32BitAbis() {

@@ -836,2 +1289,9 @@ if (OS === 'android') {

export function supported32BitAbisSync() {
if (OS === 'android') {
return RNDeviceInfo.getSupported32BitAbisSync();
}
return [];
}
export async function supported64BitAbis() {

@@ -844,2 +1304,9 @@ if (OS === 'android') {

export function supported64BitAbisSync() {
if (OS === 'android') {
return RNDeviceInfo.getSupported64BitAbisSync();
}
return [];
}
export async function hasSystemFeature(feature) {

@@ -852,2 +1319,9 @@ if (OS === 'android') {

export function hasSystemFeatureSync(feature) {
if (OS === 'android') {
return RNDeviceInfo.hasSystemFeatureSync(feature);
}
return false;
}
export async function getSystemAvailableFeatures() {

@@ -860,2 +1334,9 @@ if (OS === 'android') {

export function getSystemAvailableFeaturesSync() {
if (OS === 'android') {
return RNDeviceInfo.getSystemAvailableFeaturesSync();
}
return [];
}
export async function isLocationEnabled() {

@@ -868,2 +1349,9 @@ if (OS === 'android' || OS === 'ios') {

export function isLocationEnabledSync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.isLocationEnabledSync();
}
return false;
}
export async function getAvailableLocationProviders() {

@@ -876,67 +1364,138 @@ if (OS === 'android' || OS === 'ios') {

export function getAvailableLocationProvidersSync() {
if (OS === 'android' || OS === 'ios') {
return RNDeviceInfo.getAvailableLocationProvidersSync();
}
return {};
}
export default {
getUniqueId,
getUniqueIdSync,
getInstanceId,
getInstanceIdSync,
getSerialNumber,
getSerialNumberSync,
getAndroidId,
getAndroidIdSync,
getIpAddress,
getIpAddressSync,
getCameraPresence,
getCameraPresenceSync,
getMacAddress,
getMacAddressSync,
getDeviceId,
getDeviceIdSync,
getManufacturer,
getManufacturerSync,
getModel,
getModelSync,
getBrand,
getBrandSync,
getSystemName,
getSystemNameSync,
getSystemVersion,
getSystemVersionSync,
getBuildId,
getBuildIdSync,
getApiLevel,
getApiLevelSync,
getBundleId,
getBundleIdSync,
getApplicationName,
getApplicationNameSync,
getBuildNumber,
getBuildNumberSync,
getVersion,
getVersionSync,
getReadableVersion,
getReadableVersionSync,
getDeviceName,
getDeviceNameSync,
getUsedMemory,
getUsedMemorySync,
getUserAgent,
getUserAgentSync,
getFontScale,
getFontScaleSync,
getBootloader,
getBootloaderSync,
getDevice,
getDeviceSync,
getDisplay,
getDisplaySync,
getFingerprint,
getFingerprintSync,
getHardware,
getHardwareSync,
getHost,
getHostSync,
getProduct,
getProductSync,
getTags,
getTagsSync,
getType,
getTypeSync,
getBaseOs,
getBaseOsSync,
getPreviewSdkInt,
getPreviewSdkIntSync,
getSecurityPatch,
getSecurityPatchSync,
getCodename,
getCodenameSync,
getIncremental,
getIncrementalSync,
isEmulator,
isEmulatorSync,
isTablet,
isTabletSync,
isPinOrFingerprintSet,
isPinOrFingerprintSetSync,
hasNotch,
hasNotchSync,
getFirstInstallTime,
getFirstInstallTimeSync,
getInstallReferrer,
getInstallReferrerSync,
getLastUpdateTime,
getLastUpdateTimeSync,
getPhoneNumber,
getPhoneNumberSync,
getCarrier,
getCarrierSync,
getTotalMemory,
getTotalMemorySync,
getMaxMemory,
getMaxMemorySync,
getTotalDiskCapacity,
getTotalDiskCapacitySync,
getFreeDiskStorage,
getFreeDiskStorageSync,
getBatteryLevel,
getBatteryLevelSync,
getPowerState,
getPowerStateSync,
isBatteryCharging,
isBatteryChargingSync,
isLandscape,
isLandscapeSync,
isAirplaneMode,
isAirplaneModeSync,
getDeviceType,
getDeviceTypeSync,
supportedAbis,
supportedAbisSync,
supported32BitAbis,
supported32BitAbisSync,
supported64BitAbis,
supported64BitAbisSync,
hasSystemFeature,
hasSystemFeatureSync,
getSystemAvailableFeatures,
getSystemAvailableFeaturesSync,
isLocationEnabled,
isLocationEnabledSync,
getAvailableLocationProviders,
getAvailableLocationProvidersSync,
};
{
"name": "react-native-device-info",
"version": "3.0.0-rc.1",
"version": "3.0.0-rc.2",
"description": "Get device information using react-native",

@@ -59,3 +59,3 @@ "main": "deviceinfo.js",

"eslint-plugin-prettier": "^3.1.0",
"flow-bin": "^0.106.3",
"flow-bin": "^0.107.0",
"husky": "^3.0.5",

@@ -62,0 +62,0 @@ "lint-staged": "^9.2.1",

@@ -267,2 +267,4 @@ <!-- markdownlint-disable MD024 MD034 MD033 -->

Every API returns a Promise but also has a corresponding API with 'Sync' on the end that operates synchronously. For example, you may prefer to call 'getCameraPresenceSync()' during your app bootstrap to avoid async calls during the first parts of app startup.
| Method | Return Type | iOS | Android | Windows |

@@ -1077,3 +1079,3 @@ | ----------------------------------------------------------------- | ------------------- | :-: | :-----: | :-----: |

Gets the device unique ID.
Gets the device unique ID.
On Android it is currently identical to getAndroidId() in this module

@@ -1080,0 +1082,0 @@ On iOS it uses the DeviceUID uid identifier

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc