@triplesense/capacitor-device-info
v1.2.0-1
Published
_
Downloads
97
Readme
Capacitor Device Info Plugin
This plugin is a complement to the oficial Device Plugin.
Current version 1.2.0-0
See our detailed changelog for the latest features, improvements and bug fixes.
Features
- [x] Get the device identification (iOS only. On Android will return model)
- [x] Device specific model (iOS only. Improve oficial Device Plugin generic device model information).
- [x] Device device RAM total size
- [x] Device device total disk size.(Resolves oficial Device Plugin disk size on android).
Installation
npm
npm i @triplesense/capacitor-device-info
Usage
First make sure to import the plugin, then get the Device info:
import { DeviceInfo, DeviceX } from '@triplesense/capacitor-device-info';
export const getDeviceInfo = async (): Promise<DeviceInfo> => {
const { model, memRamTotal, diskTotal, identifier } = await DeviceX.getInfo();
return {
model,
memRamTotal,
diskTotal,
identifier,
};
};
API
getInfo()
getInfo() => Promise<DeviceInfo>
Get device info.
platform: android, ios
Returns: Promise<DeviceInfo>
Interfaces
DeviceInfo
| Prop | Type | Description |
| ----------------- | ------------------- | ------------------------------------------------------------- |
| diskTotal
| number | Total disk size. |
| memRamTotal
| number | Total ram memory size. |
| model
| string | Device specific model. |
| identifier
| string | Device specific model (on ios). On android will return model. |
Source of Information
All model identifiers are taken from the following website: https://www.theiphonewiki.com/wiki/Models or extracted from the simulator app bundled with Xcode.
Note:
This plugin uses DeviceKit Library to get ios device info.
Contributing
If you have the need for a specific feature that you want implemented or if you experienced a bug, please open an issue. If you extended the functionality of @triplesense/capacitor-device-info yourself and want others to use it too, please submit a pull request.