Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

react-native-device-info

Package Overview
Dependencies
Maintainers
5
Versions
264
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-beta.2
to
3.0.0-beta.3
+56
-28
android/src/main/j...arnium/RNDeviceInfo/RNDeviceModule.java

@@ -55,3 +55,2 @@ package com.learnium.RNDeviceInfo;

@SuppressWarnings("WeakerAccess")
@ReactModule(name = RNDeviceModule.NAME)

@@ -190,2 +189,3 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {

p.resolve(keyguardManager.isKeyguardSecure());
return;
}

@@ -213,3 +213,2 @@ p.reject("EUNSPECIFIED", "Unable to determine keyguard status. KeyguardManager was null");

@ReactMethod
@SuppressWarnings("ConstantConditions")
public void getCameraPresence(Promise p) {

@@ -347,10 +346,10 @@ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

@ReactMethod
public void isAirPlaneMode(Promise p) {
boolean isAirPlaneMode;
public void isAirplaneMode(Promise p) {
boolean isAirplaneMode;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
isAirPlaneMode = Settings.System.getInt(getReactApplicationContext().getContentResolver(),Settings.System.AIRPLANE_MODE_ON, 0) != 0;
isAirplaneMode = Settings.System.getInt(getReactApplicationContext().getContentResolver(),Settings.System.AIRPLANE_MODE_ON, 0) != 0;
} else {
isAirPlaneMode = Settings.Global.getInt(getReactApplicationContext().getContentResolver(),Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
isAirplaneMode = Settings.Global.getInt(getReactApplicationContext().getContentResolver(),Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
}
p.resolve(isAirPlaneMode);
p.resolve(isAirplaneMode);
}

@@ -366,4 +365,3 @@

boolean hasFeature = getReactApplicationContext().getPackageManager().hasSystemFeature(feature);
p.resolve(hasFeature);
p.resolve(getReactApplicationContext().getPackageManager().hasSystemFeature(feature));
}

@@ -385,3 +383,2 @@

@SuppressWarnings("ConstantConditions")
@ReactMethod

@@ -397,2 +394,3 @@ public void isLocationEnabled(Promise p) {

p.reject("EUNSPECIFIED", "Unable to determine if location enabled. LocationManager was null");
return;
}

@@ -411,3 +409,2 @@ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

@ReactMethod
@SuppressWarnings("ConstantConditions")
public void getAvailableLocationProviders(Promise p) {

@@ -420,2 +417,3 @@ LocationManager mLocationManager = (LocationManager) getReactApplicationContext().getSystemService(Context.LOCATION_SERVICE);

p.reject("EUNSPECIFIED", "Unable to get location providers. LocationManager was null");
return;
}

@@ -434,3 +432,3 @@

SharedPreferences sharedPref = getReactApplicationContext().getSharedPreferences("react-native-device-info", Context.MODE_PRIVATE);
p.resolve(sharedPref.getString("installReferrer", null));
p.resolve(sharedPref.getString("installReferrer", Build.UNKNOWN));
}

@@ -462,3 +460,3 @@

public void getBuildVersion(Promise p) {
p.resolve("not available");
p.resolve(Build.UNKNOWN);
}

@@ -496,16 +494,40 @@

try {
if (Build.VERSION.SDK_INT >= 25) {
p.resolve(Settings.Global.getString(getReactApplicationContext().getContentResolver(), Settings.Global.DEVICE_NAME));
} else {
p.resolve(Settings.Secure.getString(getReactApplicationContext().getContentResolver(), "bluetooth_name"));
}
String bluetoothName = Settings.Secure.getString(getReactApplicationContext().getContentResolver(), "bluetooth_name");
if (bluetoothName != null) {
p.resolve(bluetoothName);
return;
}
if (Build.VERSION.SDK_INT >= 25) {
String deviceName = Settings.Global.getString(getReactApplicationContext().getContentResolver(), Settings.Global.DEVICE_NAME);
if (deviceName != null) {
p.resolve(deviceName);
return;
}
}
} catch (Exception e) {
p.reject(e);
return;
}
p.resolve(Build.UNKNOWN);
}
@SuppressLint("HardwareIds")
@SuppressLint({"HardwareIds", "MissingPermission"})
@ReactMethod
public void getSerialNumber(Promise p) { p.resolve(Build.SERIAL); }
public void getSerialNumber(Promise p) {
try {
if (Build.VERSION.SDK_INT >= 26) {
if (getReactApplicationContext().checkCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
p.resolve(Build.getSerial());
return;
}
}
} catch (Exception e) {
// This is almost always a PermissionException. We will log it but return unknown
System.err.println("getSerialNumber failed, it probably should not be used: " + e.getMessage());
}
p.resolve(Build.UNKNOWN);
}
@ReactMethod

@@ -575,3 +597,7 @@ public void getSystemName(Promise p) { p.resolve("Android"); }

@SuppressLint("HardwareIds")
@ReactMethod
public void getAndroidId(Promise p) { p.resolve(getString(getReactApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID)); }
@ReactMethod
public void getMaxMemory(Promise p) { p.resolve((double)Runtime.getRuntime().maxMemory()); }

@@ -590,2 +616,3 @@

p.reject("EUNSPECIFIED", "Unable to getMemoryInfo. ActivityManager was null");
return;
}

@@ -608,8 +635,9 @@ p.resolve((double)memInfo.totalMem);

@ReactMethod
public void getBaseOS(Promise p) {
public void getBaseOs(Promise p) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
p.resolve(Build.VERSION.BASE_OS);
} else {
p.resolve("not available");
return;
}
p.resolve(Build.UNKNOWN);
}

@@ -621,5 +649,5 @@

p.resolve(Build.VERSION.PREVIEW_SDK_INT);
} else {
p.resolve("not available");
return;
}
p.resolve(Build.UNKNOWN);
}

@@ -631,5 +659,5 @@

p.resolve(Build.VERSION.SECURITY_PATCH);
} else {
p.resolve("not available");
return;
}
p.resolve(Build.UNKNOWN);
}

@@ -664,3 +692,3 @@

} else {
p.resolve(null);
p.resolve(Build.UNKNOWN);
}

@@ -667,0 +695,0 @@ }

<!-- markdownlint-disable MD024 MD034 MD033 -->
# Release Notes
## 3.0.0-rc.3
* fix some real android device v2->v3 discrepancies
* BREAKING CHANGE: more capitalization changes for API calls to standardize (see below)
* BREAKING CHANGE: more return value changes to standardize return values (see below)
## 3.0.0-rc.2
* fix all emulator/simulator v2->v3 discrepancies
## 3.0.0-rc.1
* BREAKING CHANGE: Everything returns a Promise now. No more constants (no more explicit async Android constructor)
* BREAKING CHANGE: Renamed getSupportedABIs to getSupportedAbis for consistency with other getXxxAbis methods
* BREAKING CHANGE: all events prefixed with 'RNDeviceInfo_' to future-proof against collisions (https://github.com/react-native-community/react-native-device-info/issues/620)
Each BREAKING CHANGE contains the required information to migrate. The example App.js shows sample usage.
* BREAKING CHANGE: Every API call returns a Promise now (and thus no more Android constructor with async boolean argument)
* This was required to improve module load speed, handle dynamic values, and release the main queue for iOS
* BREAKING CHANGE: Every API call with acronyms ('getIP', 'getABI' etc follows pure camel-case now, e.g. 'getIp', 'getAbi')
* This naming style is a consensus standard. Previously APIs here were half one way half the other. Now they are consistent
* isAirPlaneMode -> isAirplaneMode
* getIPAddress -> getIpAddress
* getMACAddress -> getMACAddress
* getAPILevel -> GetApiLevel
* getBaseOS -> getBaseOs
* getInstanceID -> getInstanceId
* getUniqueID -> getUniqueId
* supportedABIs -> supportedAbis
* BREAKING CHANGE: all events prefixed with 'RNDeviceInfo_' (https://github.com/react-native-community/react-native-device-info/issues/620)
* This is required as event names are a global namespace and collisions are inevitable otherwise
* powerStateDidChange -> RNDeviceInfo_powerStateDidChange
* batteryLevelDidChange -> RNDeviceInfo_batteryLevelDidChange
* batteryLevelIsLow -> RNDeviceInfo_batteryLevelIsLow
* BREAKING CHANGE: Android `getBuildNumber` returns string like iOS (https://github.com/react-native-community/react-native-device-info/pull/648)
* BREAKING CHANGE: remove is24Hour, getTimezone, isAutoTimeZone and isAutoDateAndTime, getDeviceLocale, getDeviceCountry, getPreferredLocales. react-native-localize is superior
* BREAKING CHANGE: remove is24Hour, getTimezone, isAutoTimeZone and isAutoDateAndTime, getDeviceLocale, getDeviceCountry, getPreferredLocales
* This was the result of a survey. It removes API duplication in the react-native-community modules
* Related PR: https://github.com/react-native-community/react-native-localize/pull/65
* Use `yarn add https://github.com/mikehardy/react-native-localize.git#e062f0d2dc3171dc18fdb7b7139d347ad03933dc` to maintain isAutoTimeZone + isAutoDateAndTime until merged
* BREAKING CHANGE: iOS switch deprecated WebView for WebKit / getUserAgent returns Promise (https://github.com/react-native-community/react-native-device-info/pull/757)
* The change from WebView to WebKit was required as the API is being removed from the iOS platform
* BREAKING CHANGE: if an API is platform-specific, all non-implementing platforms will return standard values of -1, false, or 'unknown' depending on return type
* This was how most APIs behaved before but it was not 100% - some returned null or empty string before
* getPhoneNumber sometimes returned null, now it will be 'unknown' if not known
* deprecated: IP-address-related methods deprecated - use @react-native-community/netinfo or react-native-network-info or react-native-carrier-info
* feat: all APIs are now restricted in Javascirpt to the platforms they have full implementations on so the web polyfill is up to date
* feat: 'getAndroidId' on Android returns android.provider.Settings.Secure.ANDROID_ID, read platform docs for usage
* feat: `getUsedMemory` (https://github.com/rebeccahughes/react-native-device-info/pull/356)

@@ -16,0 +49,0 @@ * feat: getDeviceName() without Bluetooth permission on Android (https://github.com/react-native-community/react-native-device-info/issues/735)

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

declare const _default: {
getUniqueID: () => Promise<string>;
getUniqueId: () => Promise<string>;
getManufacturer: () => Promise<string>;

@@ -37,3 +37,3 @@ getBrand: () => Promise<string>;

getUserAgent: () => Promise<string>;
getInstanceID: () => Promise<string>;
getInstanceId: () => Promise<string>;
getInstallReferrer: () => string | null;

@@ -52,3 +52,3 @@ isEmulator: () => Promise<boolean>;

getType: () => Promise<string>;
getBaseOS: () => Promise<string>;
getBaseOs: () => Promise<string>;
getPreviewSdkInt: () => Promise<number>;

@@ -63,7 +63,8 @@ getSecurityPatch: () => Promise<string>;

getSerialNumber: () => Promise<string>;
getIPAddress: () => Promise<string>;
getAndroidId: () => Promise<string>;
getIpAddress: () => Promise<string>;
getCameraPresence: () => Promise<boolean>;
getMACAddress: () => Promise<string>;
getMacAddress: () => Promise<string>;
getPhoneNumber: () => Promise<string>;
getAPILevel: () => Promise<number>;
getApiLevel: () => Promise<number>;
getCarrier: () => Promise<string>;

@@ -78,3 +79,3 @@ getTotalMemory: () => Promise<number>;

isLandscape: () => Promise<boolean>;
isAirPlaneMode: () => Promise<boolean>;
isAirplaneMode: () => Promise<boolean>;
getDeviceType: () => Promise<DeviceType>;

@@ -81,0 +82,0 @@ supportedAbis: () => Promise<string[]>;

@@ -7,4 +7,5 @@ /**

var RNDeviceInfo = NativeModules.RNDeviceInfo;
var OS = Platform.OS;
if (Platform.OS === 'web' || Platform.OS === 'dom') {
if (OS === 'web' || OS === 'dom') {
RNDeviceInfo = require('./web');

@@ -14,10 +15,5 @@ }

// Produce an error if we don't have the native module
if (
Platform.OS === 'android' ||
Platform.OS === 'ios' ||
Platform.OS === 'web' ||
Platform.OS === 'dom'
) {
if (OS === 'android' || OS === 'ios' || OS === 'web' || OS === 'dom') {
throw new Error(`@react-native-community/react-native-device-info: NativeModule.RNDeviceInfo is null. To fix this issue try these steps:
• Run \`react-native link react-native-device-info\` in the project root.
• For react-native <= 0.59: Run \`react-native link react-native-device-info\` in the project root.
• Rebuild and re-run the app.

@@ -27,4 +23,2 @@ • If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.

}
RNDeviceInfo = require('./default');
}

@@ -358,36 +352,68 @@

export async function getUniqueID() {
return RNDeviceInfo.getUniqueId();
export async function getUniqueId() {
if (OS === 'android' || OS === 'ios' || OS === 'windows') {
return RNDeviceInfo.getUniqueId();
}
return Promise.resolve('unknown');
}
export async function getInstanceID() {
return RNDeviceInfo.getInstanceId();
export async function getInstanceId() {
if (OS === 'android') {
return RNDeviceInfo.getInstanceId();
} else {
return Promise.resolve('unknown');
}
}
export async function getSerialNumber() {
return RNDeviceInfo.getSerialNumber();
if (OS === 'android') {
return RNDeviceInfo.getSerialNumber();
}
return Promise.resolve('unknown');
}
export async function getIPAddress() {
return RNDeviceInfo.getIpAddress();
export async function getAndroidId() {
if (OS === 'android') {
return RNDeviceInfo.getAndroidId();
}
return Promise.resolve('unknown');
}
export async function getIpAddress() {
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getIpAddress();
}
return Promise.resolve('unknown');
}
export async function getCameraPresence() {
return RNDeviceInfo.getCameraPresence();
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getCameraPresence();
}
return Promise.resolve(false);
}
export async function getMACAddress() {
return RNDeviceInfo.getMacAddress();
export async function getMacAddress() {
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getMacAddress();
}
return Promise.resolve('unknown');
}
export async function getDeviceId() {
return RNDeviceInfo.getDeviceId();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getDeviceId();
}
return Promise.resolve('unknown');
}
export async function getManufacturer() {
return RNDeviceInfo.getSystemManufacturer();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getSystemManufacturer();
}
return Promise.resolve('unknown');
}
export async function getModel() {
if (Platform.OS === 'ios') {
if (OS === 'ios') {
var deviceName;

@@ -411,41 +437,70 @@ var deviceId = await RNDeviceInfo.getDeviceId();

return Promise.resolve(deviceName);
} else {
}
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getModel();
}
return Promise.resolve('unknown');
}
export async function getBrand() {
return RNDeviceInfo.getBrand();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getBrand();
}
return Promise.resolve('unknown');
}
export async function getSystemName() {
return RNDeviceInfo.getSystemName();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getSystemName();
}
return Promise.resolve('unknown');
}
export async function getSystemVersion() {
return RNDeviceInfo.getSystemVersion();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getSystemVersion();
}
return Promise.resolve('unknown');
}
export async function getBuildId() {
return RNDeviceInfo.getBuildId();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getBuildId();
}
return Promise.resolve('unknown');
}
export async function getAPILevel() {
return RNDeviceInfo.getApiLevel();
export async function getApiLevel() {
if (OS === 'android') {
return RNDeviceInfo.getApiLevel();
}
return Promise.resolve(-1);
}
export async function getBundleId() {
return RNDeviceInfo.getBundleId();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getBundleId();
}
return Promise.resolve('unknown');
}
export async function getApplicationName() {
return RNDeviceInfo.getAppName();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getAppName();
}
return Promise.resolve('unknown');
}
export async function getBuildNumber() {
return RNDeviceInfo.getBuildNumber();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getBuildNumber();
}
return Promise.resolve('unknown');
}
export async function getVersion() {
return RNDeviceInfo.getAppVersion();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getAppVersion();
}
return Promise.resolve('unknown');
}

@@ -458,83 +513,146 @@

export async function getDeviceName() {
return RNDeviceInfo.getDeviceName();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getDeviceName();
}
return Promise.resolve('unknown');
}
export async function getUsedMemory() {
return RNDeviceInfo.getUsedMemory();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getUsedMemory();
}
return Promise.resolve(-1);
}
export async function getUserAgent() {
return RNDeviceInfo.getUserAgent();
if (OS === 'android' || OS === 'macos' || OS === 'web') {
return RNDeviceInfo.getUserAgent();
}
return Promise.resolve('unknown');
}
export async function getFontScale() {
return RNDeviceInfo.getFontScale();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getFontScale();
}
return Promise.resolve('unknown');
}
export async function getBootloader() {
return RNDeviceInfo.getBootloader();
if (OS === 'android') {
return RNDeviceInfo.getBootloader();
}
return Promise.resolve('unknown');
}
export async function getDevice() {
return RNDeviceInfo.getDevice();
if (OS === 'android') {
return RNDeviceInfo.getDevice();
}
return Promise.resolve('unknown');
}
export async function getDisplay() {
return RNDeviceInfo.getDisplay();
if (OS === 'android') {
return RNDeviceInfo.getDisplay();
}
return Promise.resolve('unknown');
}
export async function getFingerprint() {
return RNDeviceInfo.getFingerprint();
if (OS === 'android') {
return RNDeviceInfo.getFingerprint();
}
return Promise.resolve('unknown');
}
export async function getHardware() {
return RNDeviceInfo.getHardware();
if (OS === 'android') {
return RNDeviceInfo.getHardware();
}
return Promise.resolve('unknown');
}
export async function getHost() {
return RNDeviceInfo.getHost();
if (OS === 'android') {
return RNDeviceInfo.getHost();
}
return Promise.resolve('unknown');
}
export async function getProduct() {
return RNDeviceInfo.getProduct();
if (OS === 'android') {
return RNDeviceInfo.getProduct();
}
return Promise.resolve('unknown');
}
export async function getTags() {
return RNDeviceInfo.getTags();
if (OS === 'android') {
return RNDeviceInfo.getTags();
}
return Promise.resolve('unknown');
}
export async function getType() {
return RNDeviceInfo.getType();
if (OS === 'android') {
return RNDeviceInfo.getType();
}
return Promise.resolve('unknown');
}
export async function getBaseOS() {
return RNDeviceInfo.getBaseOS();
export async function getBaseOs() {
if (OS === 'android') {
return RNDeviceInfo.getBaseOs();
}
return Promise.resolve('unknown');
}
export async function getPreviewSdkInt() {
return RNDeviceInfo.getPreviewSdkInt();
if (OS === 'android') {
return RNDeviceInfo.getPreviewSdkInt();
}
return Promise.resolve('unknown');
}
export async function getSecurityPatch() {
return RNDeviceInfo.getSecurityPatch();
if (OS === 'android') {
return RNDeviceInfo.getSecurityPatch();
}
return Promise.resolve('unknown');
}
export async function getCodename() {
return RNDeviceInfo.getCodename();
if (OS === 'android') {
return RNDeviceInfo.getCodename();
}
return Promise.resolve('unknown');
}
export async function getIncremental() {
return RNDeviceInfo.getIncremental();
if (OS === 'android') {
return RNDeviceInfo.getIncremental();
}
return Promise.resolve('unknown');
}
export async function isEmulator() {
return RNDeviceInfo.isEmulator();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.isEmulator();
}
return Promise.resolve(false);
}
export async function isTablet() {
return RNDeviceInfo.isTablet();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.isTablet();
}
return Promise.resolve(false);
}
export async function isPinOrFingerprintSet() {
return RNDeviceInfo.isPinOrFingerprintSet();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.isPinOrFingerprintSet();
}
return Promise.resolve(false);
}

@@ -555,46 +673,83 @@

export async function getFirstInstallTime() {
return RNDeviceInfo.getFirstInstallTime();
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getFirstInstallTime();
}
return Promise.resolve(-1);
}
export async function getInstallReferrer() {
return RNDeviceInfo.getInstallReferrer();
if (OS === 'android') {
return RNDeviceInfo.getInstallReferrer();
}
return Promise.resolve('unknown');
}
export async function getLastUpdateTime() {
return RNDeviceInfo.getLastUpdateTime();
if (OS === 'android') {
return RNDeviceInfo.getLastUpdateTime();
}
return Promise.resolve(-1);
}
export async function getPhoneNumber() {
return RNDeviceInfo.getPhoneNumber();
if (OS === 'android') {
return RNDeviceInfo.getPhoneNumber();
}
return Promise.resolve('unknown');
}
export async function getCarrier() {
return RNDeviceInfo.getCarrier();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getCarrier();
}
return Promise.resolve('unknown');
}
export async function getTotalMemory() {
return RNDeviceInfo.getTotalMemory();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getTotalMemory();
}
return Promise.resolve(-1);
}
export async function getMaxMemory() {
return RNDeviceInfo.getMaxMemory();
if (OS === 'android' || OS === 'windows') {
return RNDeviceInfo.getMaxMemory();
}
return Promise.resolve(-1);
}
export async function getTotalDiskCapacity() {
return RNDeviceInfo.getTotalDiskCapacity();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getTotalDiskCapacity();
}
return Promise.resolve(-1);
}
export async function getFreeDiskStorage() {
return RNDeviceInfo.getFreeDiskStorage();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getFreeDiskStorage();
}
return Promise.resolve(-1);
}
export async function getBatteryLevel() {
return RNDeviceInfo.getBatteryLevel();
if (OS === 'android' || OS === 'macos' || OS === 'windows') {
return RNDeviceInfo.getBatteryLevel();
}
return Promise.resolve(-1);
}
export async function getPowerState() {
return RNDeviceInfo.getPowerState();
if (OS === 'macos') {
return RNDeviceInfo.getPowerState();
}
return Promise.resolve({});
}
export async function isBatteryCharging() {
return RNDeviceInfo.isBatteryCharging();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.isBatteryCharging();
}
return Promise.resolve(false);
}

@@ -607,45 +762,73 @@

export async function isAirPlaneMode() {
return RNDeviceInfo.isAirPlaneMode();
export async function isAirplaneMode() {
if (OS === 'android') {
return RNDeviceInfo.isAirplaneMode();
}
return Promise.resolve(false);
}
export async function getDeviceType() {
return RNDeviceInfo.getDeviceType();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getDeviceType();
}
return Promise.resolve('unknown');
}
export async function supportedAbis() {
return RNDeviceInfo.getSupportedAbis();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getSupportedAbis();
}
return Promise.resolve([]);
}
export async function supported32BitAbis() {
return RNDeviceInfo.getSupported32BitAbis();
if (OS === 'android') {
return RNDeviceInfo.getSupported32BitAbis();
}
return Promise.resolve([]);
}
export async function supported64BitAbis() {
return RNDeviceInfo.getSupported64BitAbis();
if (OS === 'android') {
return RNDeviceInfo.getSupported64BitAbis();
}
return Promise.resolve([]);
}
export async function hasSystemFeature(feature) {
return RNDeviceInfo.hasSystemFeature(feature);
if (OS === 'android') {
return RNDeviceInfo.hasSystemFeature(feature);
}
return Promise.resolve(false);
}
export async function getSystemAvailableFeatures() {
return RNDeviceInfo.getSystemAvailableFeatures();
if (OS === 'android') {
return RNDeviceInfo.getSystemAvailableFeatures();
}
return Promise.resolve([]);
}
export async function isLocationEnabled() {
return RNDeviceInfo.isLocationEnabled();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.isLocationEnabled();
}
return Promise.resolve(false);
}
export async function getAvailableLocationProviders() {
return RNDeviceInfo.getAvailableLocationProviders();
if (OS === 'android' || OS === 'macos') {
return RNDeviceInfo.getAvailableLocationProviders();
}
return Promise.resolve({});
}
export default {
getUniqueID,
getInstanceID,
getUniqueId,
getInstanceId,
getSerialNumber,
getIPAddress,
getAndroidId,
getIpAddress,
getCameraPresence,
getMACAddress,
getMacAddress,
getDeviceId,

@@ -658,3 +841,3 @@ getManufacturer,

getBuildId,
getAPILevel,
getApiLevel,
getBundleId,

@@ -678,3 +861,3 @@ getApplicationName,

getType,
getBaseOS,
getBaseOs,
getPreviewSdkInt,

@@ -701,3 +884,3 @@ getSecurityPatch,

isLandscape,
isAirPlaneMode,
isAirplaneMode,
getDeviceType,

@@ -704,0 +887,0 @@ supportedAbis,

{
"name": "react-native-device-info",
"version": "3.0.0-beta.2",
"version": "3.0.0-beta.3",
"description": "Get device information using react-native",

@@ -13,6 +13,6 @@ "main": "deviceinfo.js",

"analyze": "yarn ts-check && yarn flow-check",
"dev-sync": "cp -r deviceinfo* *podspec default windows web android ios example/node_modules/react-native-device-info/",
"dev-sync": "cp -r deviceinfo* *podspec windows web android ios example/node_modules/react-native-device-info/",
"flow-check": "npx flow check-contents < deviceinfo.js.flow",
"lint": "npx eslint ./ --ignore-pattern example --ignore-pattern node_modules --fix --quiet",
"shipit": "np --no-yarn",
"shipit": "np",
"ts-check": "npx tsc deviceinfo.d.ts --noEmit",

@@ -61,3 +61,3 @@ "precommit": "lint-staged && yarn analyze"

"flow-bin": "^0.106.3",
"husky": "^3.0.2",
"husky": "^3.0.5",
"lint-staged": "^9.2.1",

@@ -64,0 +64,0 @@ "np": "^5.0.3",

+109
-89

@@ -260,3 +260,3 @@ <!-- markdownlint-disable MD024 MD034 MD033 -->

import { getUniqueID, getManufacturer } from 'react-native-device-info';
import { getUniqueId, getManufacturer } from 'react-native-device-info';
```

@@ -266,71 +266,74 @@

| Method | Return Type |  iOS | Android | Windows | Since |
| ----------------------------------------------------------------- | ------------------- | :--: | :-----: | :-----: | ------ |
| [getAPILevel()](#getapilevel) | `Promise<number>` | ❌ | ✅ | ❌ | 0.12.0 |
| [getApplicationName()](#getapplicationname) | `Promise<string>` | ✅ | ✅ | ✅ | 0.14.0 |
| [getBaseOS()](#getbaseOS) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getBatteryLevel()](#getbatterylevel) | `Promise<number>` | ✅ | ✅ | ✅ | 0.18.0 |
| [getBootloader()](#getbootloader) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getBrand()](#getbrand) | `Promise<string>` | ✅ | ✅ | ✅ | 0.9.3 |
| [getBuildNumber()](#getbuildnumber) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [getBundleId()](#getbundleid) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [getCameraPresence()](#getcamerapresence) | `Promise<boolean>` | ❌ | ✅ | ✅ | ? |
| [getCarrier()](#getcarrier) | `Promise<string>` | ✅ | ✅ | ❌ | 0.13.0 |
| [getCodename()](#getcodename) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getDevice()](#getdevice) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getDeviceId()](#getdeviceid) | `Promise<string>` | ✅ | ✅ | ✅ | 0.5.0 |
| [getDisplay()](#getdisplay) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getDeviceName()](#getdevicename) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [getFirstInstallTime()](#getfirstinstalltime) | `Promise<number>` | ❌ | ✅ | ✅ | 0.12.0 |
| [getFingerprint()](#getfingerprint) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getFontScale()](#getfontscale) | `Promise<number>` | ✅ | ✅ | ❌ | 0.15.0 |
| [getFreeDiskStorage()](#getfreediskstorage) | `Promise<number>` | ✅ | ✅ | ❌ | 0.15.0 |
| [getHardware()](#gethardware) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getHost()](#gethost) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getIPAddress()](#getipaddress) | `Promise<string>` | ✅ | ✅ | ✅ | 0.12.0 |
| [getIncremental()](#getincremental) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getInstallReferrer()](#getinstallreferrer) | `Promise<string>` | ❌ | ✅ | ❌ | 0.19.0 |
| [getInstanceID()](#getinstanceid) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getLastUpdateTime()](#getlastupdatetime) | `Promise<number>` | ❌ | ✅ | ❌ | 0.12.0 |
| [getMACAddress()](#getmacaddress) | `Promise<string>` | ✅ | ✅ | ❌ | 0.12.0 |
| [getManufacturer()](#getmanufacturer) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [getMaxMemory()](#getmaxmemory) | `Promise<number>` | ❌ | ✅ | ✅ | 0.14.0 |
| [getModel()](#getmodel) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [getPhoneNumber()](#getphonenumber) | `Promise<string>` | ❌ | ✅ | ❌ | 0.12.0 |
| [getPowerState()](#getpowerstate) | `Promise<object>` | ✅ | ❌ | ❌ | |
| [getProduct()](#getproduct) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getPreviewSdkInt()](#getPreviewSdkInt) | `Promise<number>` | ❌ | ✅ | ❌ | ? |
| [getReadableVersion()](#getreadableversion) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [getSerialNumber()](#getserialnumber) | `Promise<string>` | ❌ | ✅ | ❌ | 0.12.0 |
| [getSecurityPatch()](#getsecuritypatch) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getSystemName()](#getsystemname) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [getSystemVersion()](#getsystemversion) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [getBuildId()](#getbuildid) | `Promise<string>` | ✅ | ✅ | ❌ | ? |
| [getTags()](#gettags) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getType()](#gettype) | `Promise<string>` | ❌ | ✅ | ❌ | ? |
| [getTotalDiskCapacity()](#gettotaldiskcapacity) | `Promise<number>` | ✅ | ✅ | ❌ | 0.15.0 |
| [getTotalMemory()](#gettotalmemory) | `Promise<number>` | ✅ | ✅ | ❌ | 0.14.0 |
| [getUniqueID()](#getuniqueid) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [getUsedMemory()](#getusedmemory) | `Promise<number>` | ✅ | ✅ | ❌ | 3.0.0 |
| [getUserAgent()](#getuseragent) | `Promise<string>` | ✅ | ✅ | ❌ | 0.7.0 |
| [getVersion()](#getversion) | `Promise<string>` | ✅ | ✅ | ✅ | ? |
| [isAirPlaneMode()](#isairplanemode) | `Promise<boolean>` | ❌ | ✅ | ❌ | 0.25.0 |
| [isBatteryCharging()](#isbatterycharging) | `Promise<boolean>` | ✅ | ✅ | ❌ | 0.27.0 |
| [isEmulator()](#isemulator) | `Promise<boolean>` | ✅ | ✅ | ✅ | ? |
| [isPinOrFingerprintSet()](#ispinorfingerprintset) | `Promise<boolean>` | ✅ | ✅ | ✅ | 0.10.1 |
| [isTablet()](#istablet) | `Promise<boolean>` | ✅ | ✅ | ✅ | ? |
| [hasNotch()](#hasNotch) | `Promise<boolean>` | ✅ | ✅ | ✅ | 0.23.0 |
| [isLandscape()](#isLandscape) | `Promise<boolean>` | ✅ | ✅ | ✅ | 0.24.0 |
| [getDeviceType()](#getDeviceType) | `Promise<string>` | ✅ | ✅ | ❌ | ? |
| [supported32BitAbis()](#supported32BitAbis) | `Promise<string[]>` | ❌ | ✅ | ❌ | ? |
| [supported64BitAbis()](#supported64BitAbis) | `Promise<string[]>` | ❌ | ✅ | ❌ | ? |
| [supportedAbis()](#supportedAbis) | `Promise<string[]>` | ✅ | ✅ | ❌ | 1.1.0 |
| [hasSystemFeature()](#hassystemfeaturefeature) | `Promise<boolean>` | ❌ | ✅ | ❌ | ? |
| [getSystemAvailableFeatures()](#getSystemAvailableFeatures) | `Promise<string[]>` | ❌ | ✅ | ❌ | ? |
| [isLocationEnabled()](#isLocationEnabled) | `Promise<boolean>` | ✅ | ✅ | ❌ | ? |
| [getAvailableLocationProviders()](#getAvailableLocationProviders) | `Promise<Object>` | ✅ | ✅ | ❌ | ? |
Note that many APIs are platform-specific. If there is no implementation for a platform, then the "default" return values you will receive are 'unknown' for string, '-1' for number, and 'false' for boolean. Arrays and Objects will be empty ('[]' and '{}' respectively).
| Method | Return Type | iOS | Android | Windows |
| ----------------------------------------------------------------- | ------------------- | :-: | :-----: | :-----: |
| [getAndroidId()](#getandroidid) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getApiLevel()](#getapilevel) | `Promise<number>` | ❌ | ✅ | ❌ |
| [getApplicationName()](#getapplicationname) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getAvailableLocationProviders()](#getAvailableLocationProviders) | `Promise<Object>` | ✅ | ✅ | ❌ |
| [getBaseOs()](#getbaseOs) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getBuildId()](#getbuildid) | `Promise<string>` | ✅ | ✅ | ❌ |
| [getBatteryLevel()](#getbatterylevel) | `Promise<number>` | ✅ | ✅ | ✅ |
| [getBootloader()](#getbootloader) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getBrand()](#getbrand) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getBuildNumber()](#getbuildnumber) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getBundleId()](#getbundleid) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getCameraPresence()](#getcamerapresence) | `Promise<boolean>` | ❌ | ✅ | ✅ |
| [getCarrier()](#getcarrier) | `Promise<string>` | ✅ | ✅ | ❌ |
| [getCodename()](#getcodename) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getDevice()](#getdevice) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getDeviceId()](#getdeviceid) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getDeviceType()](#getDeviceType) | `Promise<string>` | ✅ | ✅ | ❌ |
| [getDisplay()](#getdisplay) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getDeviceName()](#getdevicename) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getFirstInstallTime()](#getfirstinstalltime) | `Promise<number>` | ❌ | ✅ | ✅ |
| [getFingerprint()](#getfingerprint) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getFontScale()](#getfontscale) | `Promise<number>` | ✅ | ✅ | ❌ |
| [getFreeDiskStorage()](#getfreediskstorage) | `Promise<number>` | ✅ | ✅ | ❌ |
| [getHardware()](#gethardware) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getHost()](#gethost) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getIpAddress()](#getipaddress) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getIncremental()](#getincremental) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getInstallReferrer()](#getinstallreferrer) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getInstanceId()](#getinstanceid) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getLastUpdateTime()](#getlastupdatetime) | `Promise<number>` | ❌ | ✅ | ❌ |
| [getMacAddress()](#getmacaddress) | `Promise<string>` | ✅ | ✅ | ❌ |
| [getManufacturer()](#getmanufacturer) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getMaxMemory()](#getmaxmemory) | `Promise<number>` | ❌ | ✅ | ✅ |
| [getModel()](#getmodel) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getPhoneNumber()](#getphonenumber) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getPowerState()](#getpowerstate) | `Promise<object>` | ✅ | ❌ | ❌ |
| [getProduct()](#getproduct) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getPreviewSdkInt()](#getPreviewSdkInt) | `Promise<number>` | ❌ | ✅ | ❌ |
| [getReadableVersion()](#getreadableversion) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getSerialNumber()](#getserialnumber) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getSecurityPatch()](#getsecuritypatch) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getSystemAvailableFeatures()](#getSystemAvailableFeatures) | `Promise<string[]>` | ❌ | ✅ | ❌ |
| [getSystemName()](#getsystemname) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getSystemVersion()](#getsystemversion) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getTags()](#gettags) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getType()](#gettype) | `Promise<string>` | ❌ | ✅ | ❌ |
| [getTotalDiskCapacity()](#gettotaldiskcapacity) | `Promise<number>` | ✅ | ✅ | ❌ |
| [getTotalMemory()](#gettotalmemory) | `Promise<number>` | ✅ | ✅ | ❌ |
| [getUniqueId()](#getuniqueid) | `Promise<string>` | ✅ | ✅ | ✅ |
| [getUsedMemory()](#getusedmemory) | `Promise<number>` | ✅ | ✅ | ❌ |
| [getUserAgent()](#getuseragent) | `Promise<string>` | ✅ | ✅ | ❌ |
| [getVersion()](#getversion) | `Promise<string>` | ✅ | ✅ | ✅ |
| [hasNotch()](#hasNotch) | `Promise<boolean>` | ✅ | ✅ | ✅ |
| [hasSystemFeature()](#hassystemfeaturefeature) | `Promise<boolean>` | ❌ | ✅ | ❌ |
| [isAirPlaneMode()](#isairplanemode) | `Promise<boolean>` | ❌ | ✅ | ❌ |
| [isBatteryCharging()](#isbatterycharging) | `Promise<boolean>` | ✅ | ✅ | ❌ |
| [isEmulator()](#isemulator) | `Promise<boolean>` | ✅ | ✅ | ✅ |
| [isLandscape()](#isLandscape) | `Promise<boolean>` | ✅ | ✅ | ✅ |
| [isLocationEnabled()](#isLocationEnabled) | `Promise<boolean>` | ✅ | ✅ | ❌ |
| [isPinOrFingerprintSet()](#ispinorfingerprintset) | `Promise<boolean>` | ✅ | ✅ | ✅ |
| [isTablet()](#istablet) | `Promise<boolean>` | ✅ | ✅ | ✅ |
| [supported32BitAbis()](#supported32BitAbis) | `Promise<string[]>` | ❌ | ✅ | ❌ |
| [supported64BitAbis()](#supported64BitAbis) | `Promise<string[]>` | ❌ | ✅ | ❌ |
| [supportedAbis()](#supportedAbis) | `Promise<string[]>` | ✅ | ✅ | ❌ |
---
### getAPILevel()
### getApiLevel()

@@ -342,3 +345,3 @@ Gets the API level.

```js
DeviceInfo.getAPILevel().then(apiLevel => {
DeviceInfo.getApiLevel().then(apiLevel => {
// iOS: ?

@@ -356,2 +359,16 @@ // Android: 25

### getAndroidId()
Gets the ANDROID_ID. See [API documentation](https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID) for appropriate use.
#### Examples
```js
DeviceInfo.getAndroidId().then(androidId => {
// androidId here
});
```
---
### getApplicationName()

@@ -371,3 +388,3 @@

### getBaseOS()
### getBaseOs()

@@ -379,3 +396,3 @@ The base OS build the product is based on.

```js
DeviceInfo.getBaseOS().then(baseOS => {
DeviceInfo.getBaseOs().then(baseOs => {
// "Windows", "Android" etc

@@ -688,3 +705,3 @@ });

### getIPAddress()
### getIpAddress()

@@ -697,3 +714,3 @@ **Deprecated** Gets the device current IP address. (of wifi only)

```js
DeviceInfo.getIPAddress().then(ip => {
DeviceInfo.getIpAddress().then(ip => {
// "92.168.32.44"

@@ -742,3 +759,3 @@ });

### getInstanceID()
### getInstanceId()

@@ -750,3 +767,3 @@ Gets the application instance ID.

```js
DeviceInfo.getInstanceID().then(instanceId => {
DeviceInfo.getInstanceId().then(instanceId => {
// Android: ?

@@ -776,3 +793,3 @@ });

### getMACAddress()
### getMacAddress()

@@ -784,3 +801,3 @@ Gets the network adapter MAC address.

```js
DeviceInfo.getMACAddress().then(mac => {
DeviceInfo.getMacAddress().then(mac => {
// "E5:12:D8:E5:69:97"

@@ -935,3 +952,3 @@ });

Gets the device serial number.
Gets the device serial number. Will be 'unknown' in almost all cases [unless you have a privileged app and you know what you're doing](https://developer.android.com/reference/android/os/Build.html#getSerial()).

@@ -942,5 +959,5 @@ #### Examples

DeviceInfo.getSerialNumber().then(serialNumber => {
// iOS: undefined
// Android: ?
// Windows: ?
// iOS: unknown
// Android: ? (maybe a serial number, if your app is privileged)
// Windows: unknown
});

@@ -1071,5 +1088,8 @@ ```

### getUniqueID()
### getUniqueId()
Gets the device unique ID.
Gets the device unique ID.
On Android it is currently identical to getAndroidId() in this module
On iOS it uses the DeviceUID uid identifier
On Windows it uses Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation.id

@@ -1079,3 +1099,3 @@ #### Examples

```js
DeviceInfo.getUniqueID().then(uniqueId => {
DeviceInfo.getUniqueId().then(uniqueId => {
// iOS: "FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9"

@@ -1142,5 +1162,5 @@ // Android: "dd96dec43fb81c97"

### isAirPlaneMode()
### isAirplaneMode()
Tells if the device is in AirPlaneMode.
Tells if the device is in Airplane Mode.

@@ -1150,3 +1170,3 @@ #### Examples

```js
DeviceInfo.isAirPlaneMode().then(airPlaneModeOn => {
DeviceInfo.isAirplaneMode().then(airplaneModeOn => {
// false

@@ -1382,3 +1402,3 @@ });

### batteryLevelDidChange
### RNDeviceInfo_batteryLevelDidChange

@@ -1400,3 +1420,3 @@ Fired when the battery level changes; sent no more frequently than once per minute.

### batteryLevelIsLow
### RNDeviceInfo_batteryLevelIsLow

@@ -1418,3 +1438,3 @@ Fired when the battery drops below 20%.

### powerStateDidChange
### RNDeviceInfo_powerStateDidChange

@@ -1421,0 +1441,0 @@ Fired when the battery state changes, for example when the device enters charging mode or is unplugged.

/**
* react-native-web empty polyfill.
*/
var RNDeviceInfo = require('../default');
RNDeviceInfo.userAgent = window.navigator.userAgent;
module.exports = RNDeviceInfo;
module.exports = {
getUserAgent: () => {
return Promise.resolve(window.navigator.userAgent);
},
};

@@ -113,18 +113,2 @@ using ReactNative.Bridge;

[ReactMethod]
public async void getCameraPresence(IPromise promise)
{
var devices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(Windows.Devices.Enumeration.DeviceClass.VideoCapture);
promise.Resolve(devices.Count > 0);
}
[ReactMethod]
public async void getAppVersion(IPromise promise) { promise.Resolve("not available"); }
[ReactMethod]
public async void getBuildVersion(IPromise promise) { promise.Resolve("not available"); }
[ReactMethod]
public async void getBuildNumber(IPromise promise) { promise.Resolve(0); }
[ReactMethod]
public async void getAppVersion(IPromise promise)

@@ -164,20 +148,5 @@ {

[ReactMethod]
public async void getInstanceId(IPromise promise) { promise.Resolve("not available"); }
[ReactMethod]
public async void getSystemName(IPromise promise) { promise.Resolve("Windows"); }
[ReactMethod]
public async void getApiLevel(IPromise promise) { promise.Resolve("not available"); }
[ReactMethod]
public async void getBuildId(IPromise promise) { promise.Resolve("not available"); }
[ReactMethod]
public async void getUserAgent(IPromise promise) { promise.Resolve("not available"); }
[ReactMethod]
public async void getCarrier(IPromise promise) { promise.Resolve("not available"); }
[ReactMethod]
public async void getMaxMemory(IPromise promise) { promise.Resolve(MemoryManager.AppMemoryUsageLimit); }

@@ -184,0 +153,0 @@

/**
* Automatically generated file. DO NOT MODIFY
*/
package com.learnium.RNDeviceInfo;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String LIBRARY_PACKAGE_NAME = "com.learnium.RNDeviceInfo";
/**
* @deprecated APPLICATION_ID is misleading in libraries. For the library package name use LIBRARY_PACKAGE_NAME
*/
@Deprecated
public static final String APPLICATION_ID = "com.learnium.RNDeviceInfo";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 2;
public static final String VERSION_NAME = "1.1";
}
/**
* Empty default export functions.
*/
module.exports = {
uniqueId: () => Promise.resolve(''),
instanceId: () => Promise.resolve(''),
serialNumber: () => Promise.resolve(''),
getIpAddress: () => Promise.resolve(''),
getMacAddress: () => Promise.resolve(''),
deviceId: () => Promise.resolve(''),
systemManufacturer: () => Promise.resolve(''),
model: () => Promise.resolve(''),
brand: () => Promise.resolve(''),
systemName: () => Promise.resolve(''),
systemVersion: () => Promise.resolve(''),
buildId: () => Promise.resolve(''),
apiLevel: () => Promise.resolve(0),
bundleId: () => Promise.resolve(''),
appName: () => Promise.resolve(''),
buildNumber: () => Promise.resolve(0),
appVersion: () => Promise.resolve(0),
deviceName: () => Promise.resolve(''),
getUsedMemory: () => Promise.resolve(0),
userAgent: () => Promise.resolve(''),
fontScale: () => Promise.resolve(0),
isEmulator: () => Promise.resolve(false),
isTablet: () => Promise.resolve(false),
isPinOrFingerprintSet: () => Promise.resolve(false),
firstInstallTime: () => Promise.resolve(0),
installReferrer: () => Promise.resolve(''),
lastUpdateTime: () => Promise.resolve(0),
phoneNumber: () => Promise.resolve(''),
carrier: () => Promise.resolve(''),
totalMemory: () => Promise.resolve(0),
maxMemory: () => Promise.resolve(0),
totalDiskCapacity: () => Promise.resolve(0),
freeDiskStorage: () => Promise.resolve(0),
getBatteryLevel: () => Promise.resolve(0),
isLandscape: () => Promise.resolve(false),
deviceType: () => Promise.resolve('Unknown'),
getPowerState: () => Promise.resolve({}),
hasSystemFeature: () => Promise.resolve(false),
getSystemAvailableFeatures: () => Promise.resolve([]),
getCameraPresence: () => Promise.resolve(false),
isLocationEnabled: () => Promise.resolve(false),
getAvailableLocationProviders: () => Promise.resolve({}),
};
{
"name": "example",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-device-info": "github:react-native-community/react-native-device-info"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/runtime": "^7.5.5",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.2.2",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
# react-native-device-info example project
## Installation
* `git clone https://github.com/react-native-community/react-native-device-info.git`
* `cd react-native-device-info/example`
* `npm install`
## Running Android
* make sure you have no other packagers running!
* `react-native start`
* start an emulator (e.g., using Android Studio -> Tools -> AVD Manager -> start one)
* `react-native run-android`
## Running iOS
* make sure you have no other packagers running!
* `react-native start`
### Without CocoaPods
* `react-native run-ios`
### With CocoaPods
* `cd ios && pod install && cd ..`
* `react-native run-ios`
## Troubleshooting
* if things don't work, clean up all your build and node_modules folders, npm install and rebuild

Sorry, the diff of this file is not supported yet