Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@capacitor/device
Advanced tools
The Device API exposes internal information about the device, such as the model and operating system version, along with user information such as unique ids.
The Device API exposes internal information about the device, such as the model and operating system version, along with user information such as unique ids.
npm install @capacitor/device
npx cap sync
import { Device } from '@capacitor/device';
const logDeviceInfo = async () => {
const info = await Device.getInfo();
console.log(info);
};
const logBatteryInfo = async () => {
const info = await Device.getBatteryInfo();
console.log(info);
};
getId() => Promise<DeviceId>
Return an unique identifier for the device.
Returns: Promise<DeviceId>
Since: 1.0.0
getInfo() => Promise<DeviceInfo>
Return information about the underlying device/os/platform.
Returns: Promise<DeviceInfo>
Since: 1.0.0
getBatteryInfo() => Promise<BatteryInfo>
Return information about the battery.
Returns: Promise<BatteryInfo>
Since: 1.0.0
getLanguageCode() => Promise<GetLanguageCodeResult>
Get the device's current language locale code.
Returns: Promise<GetLanguageCodeResult>
Since: 1.0.0
getLanguageTag() => Promise<LanguageTag>
Get the device's current language locale tag.
Returns: Promise<LanguageTag>
Since: 4.0.0
Prop | Type | Description | Since |
---|---|---|---|
uuid | string | The UUID of the device as available to the app. This identifier may change on modern mobile platforms that only allow per-app install UUIDs. On web, a random identifier is generated and stored on localStorage for subsequent calls. If localStorage is not available a new random identifier will be generated on every call. | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
name | string | The name of the device. For example, "John's iPhone". This is only supported on iOS and Android 7.1 or above. | 1.0.0 |
model | string | The device model. For example, "iPhone13,4". | 1.0.0 |
platform | 'ios' | 'android' | 'web' | The device platform (lowercase). | 1.0.0 |
operatingSystem | OperatingSystem | The operating system of the device. | 1.0.0 |
osVersion | string | The version of the device OS. | 1.0.0 |
manufacturer | string | The manufacturer of the device. | 1.0.0 |
isVirtual | boolean | Whether the app is running in a simulator/emulator. | 1.0.0 |
memUsed | number | Approximate memory used by the current app, in bytes. Divide by 1048576 to get the number of MBs used. | 1.0.0 |
diskFree | number | How much free disk space is available on the normal data storage path for the os, in bytes. On Android it returns the free disk space on the "system" partition holding the core Android OS. On iOS this value is not accurate. | 1.0.0 |
diskTotal | number | The total size of the normal data storage path for the OS, in bytes. On Android it returns the disk space on the "system" partition holding the core Android OS. | 1.0.0 |
realDiskFree | number | How much free disk space is available on the normal data storage, in bytes. | 1.1.0 |
realDiskTotal | number | The total size of the normal data storage path, in bytes. | 1.1.0 |
webViewVersion | string | The web view browser version | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
batteryLevel | number | A percentage (0 to 1) indicating how much the battery is charged. | 1.0.0 |
isCharging | boolean | Whether the device is charging. | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
value | string | Two character language code. | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
value | string | Returns a well-formed IETF BCP 47 language tag. | 4.0.0 |
'ios' | 'android' | 'windows' | 'mac' | 'unknown'
FAQs
The Device API exposes internal information about the device, such as the model and operating system version, along with user information such as unique ids.
We found that @capacitor/device demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.