react-native-jsi-device-info
v0.1.4
Published
Device Information For React Native Through JSI
Readme
react-native-jsi-device-info
Device Information Through JSI for React Native.
Installation
Vanilla React Native
yarn
yarn add react-native-jsi-device-infoor
npm
npm install react-native-jsi-device-infoAnd
cd ios && pod installExpo
expo install react-native-jsi-device-info
expo prebuildBasic usage example
import JSIDeviceInfo from "react-native-jsi-device-info";
JSIDeviceInfo.getDeviceName() // returns Device Name
// Example
// iOS: "Khant Si Thu's iPhone 7"
// Android: ?
// Windows: ?Run the example app for more.
API
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).
The example app in this repository shows an example usage of every single API, consult the example app if you have questions, and if you think you see a problem make sure you can reproduce it using the example app before reporting it, thank you.
| Method | Return Type | iOS | Android |
| ----------------------------------------------------------------- | ------------------- | :--: | :-----: |
| getAndroidId() | string | ❌ | ✅ |
| getApiLevel() | number | ❌ | ✅ |
| getApplicationName() | string | ✅ | ✅ |
| getAvailableLocationProviders() | Object | 🚧 | 🚧 |
| getBaseOs() | string | ❌ | ✅ |
| getBuildId() | string | ✅ | ✅ |
| getBatteryLevel() | string | ✅ | ✅ |
| getBootloader() | string | 🚧 | 🚧 |
| getBrand() | string | ✅ | ✅ |
| getBuildNumber() | string | ✅ | ✅ |
| getBundleId() | string | ✅ | ✅ |
| isCameraPresent() | boolean | 🚧 | 🚧 |
| getCarrier() | string | 🚧 | 🚧 |
| getCodename() | string | 🚧 | 🚧 |
| getDevice() | string | 🚧 | 🚧 |
| getDeviceId() | string | 🚧 | 🚧 |
| getDeviceType() | string | 🚧 | 🚧 |
| getDisplay() | string | 🚧 | 🚧 |
| getDeviceName() | string | ✅ | ✅ |
| getDeviceToken() | string | ✅ | ❌ |
| getFirstInstallTime() | number | 🚧 | 🚧 |
| getFingerprint() | string | ❌ | ✅ |
| getFontScale() | number | 🚧 | 🚧 |
| getFreeDiskStorage() | number | 🚧 | 🚧 |
| getFreeDiskStorageOld() | number | 🚧 | 🚧 |
| getHardware() | string | 🚧 | 🚧 |
| getHost() | string | 🚧 | 🚧 |
| getIpAddress() | string | ✅ | ✅ |
| getIncremental() | string | 🚧 | 🚧 |
| getInstallerPackageName() | string | 🚧 | 🚧 |
| getInstallReferrer() | string | 🚧 | 🚧 |
| getInstanceId() | string | 🚧 | 🚧 |
| getLastUpdateTime() | number | 🚧 | 🚧 |
| getMacAddress() | string | 🚧 | 🚧 |
| getManufacturer() | string | ✅ | ✅ |
| getMaxMemory() | number | 🚧 | 🚧 |
| getModel() | string | ✅ | ✅ |
| getPhoneNumber() | string | 🚧 | 🚧 |
| getPowerState() | object | 🚧 | 🚧 |
| getProduct() | string | 🚧 | 🚧 |
| getPreviewSdkInt() | number | 🚧 | 🚧 |
| getReadableVersion() | string | 🚧 | 🚧 |
| getSerialNumber() | string | 🚧 | 🚧 |
| getSecurityPatch() | string | ❌ | ✅ |
| getSystemAvailableFeatures() | string[] | 🚧 | 🚧 |
| getSystemName() | string | 🚧 | 🚧 |
| getSystemVersion() | string | 🚧 | 🚧 |
| getTags() | string | 🚧 | 🚧 |
| getType() | string | 🚧 | 🚧 |
| getTotalDiskCapacity() | number | 🚧 | 🚧 |
| getTotalDiskCapacityOld() | number | 🚧 | 🚧 |
| getTotalMemory() | number | 🚧 | 🚧 |
| getUniqueId() | string | 🚧 | 🚧 |
| getUsedMemory() | number | 🚧 | 🚧 |
| getUserAgent() | string | 🚧 | 🚧 |
| getVersion() | string | 🚧 | 🚧 |
| getBrightness() | number | 🚧 | 🚧 |
| hasGms() | boolean | 🚧 | 🚧 |
| hasHms() | boolean | 🚧 | 🚧 |
| hasNotch() | boolean | 🚧 | 🚧 |
| hasSystemFeature() | boolean | 🚧 | 🚧 |
| isAirplaneMode() | boolean | 🚧 | 🚧 |
| isBatteryCharging() | boolean | 🚧 | 🚧 |
| isEmulator() | boolean | 🚧 | 🚧 |
| isKeyboardConnected() | boolean | 🚧 | 🚧 |
| isLandscape() | boolean | 🚧 | 🚧 |
| isLocationEnabled() | boolean | 🚧 | 🚧 |
| isMouseConnected() | boolean | 🚧 | 🚧 |
| isHeadphonesConnected() | boolean | 🚧 | 🚧 |
| isPinOrFingerprintSet() | boolean | 🚧 | 🚧 |
| isTablet() | boolean | 🚧 | 🚧 |
| isTabletMode() | boolean | 🚧 | 🚧 |
| supported32BitAbis() | string[] | 🚧 | 🚧 |
| supported64BitAbis() | string[] | 🚧 | 🚧 |
| supportedAbis() | string[] | 🚧 | 🚧 |
| syncUniqueId() | string | 🚧 | 🚧 |
Thanks to these libraries & their authors:
The initial work done by authors of the following libraries has helped a lot in keeping this repo updated.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
