# @awesome-cordova-library/device

> This plugin defines a global device object, which describes the device's hardware and software. Although the object is in the global scope, it is not available until after the deviceready event.

Latest version **1.0.8** (published 2023-09-12) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install @awesome-cordova-library/device
pnpm add @awesome-cordova-library/device
yarn add @awesome-cordova-library/device
bun add @awesome-cordova-library/device
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2023-09-12 |
| First published | 2022-05-31 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Jordan AZOULAY |
| Maintainers | joazco |
| Keywords | cordova, capacitor, ionic, javascript, mobile, device, device info |

## Links

- npm: https://www.npmjs.com/package/@awesome-cordova-library/device
- Repository: https://github.com/joazco/awesome-cordova-library
- Issues: https://github.com/joazco/awesome-cordova-library/issues
- npm.io page: https://npm.io/package/@awesome-cordova-library/device

## Recent versions

- 1.0.8 (latest) — 2023-09-12
- 1.0.7 — 2022-12-21
- 1.0.6 — 2022-05-31
- 1.0.5 — 2022-05-31
- 1.0.4 — 2022-05-31
- 1.0.3 — 2022-05-31
- 1.0.1 — 2022-05-31
- 1.0.0 — 2022-05-31

## README

---
id: plugin-device
title: Device
tags:
  - cordova
  - capacitor
  - ionic
  - javascript
  - typescript
  - plugin
  - mobile
  - device
---

# Device

This plugin defines a global device object, which describes the device's hardware and software. Although the object is in the global scope, it is not available until after the deviceready event.

[Online documentation](https://awesomecordovalibrary.com)

[Cordova documentation](https://cordova.apache.org/docs/en/11.x/reference/cordova-plugin-device/index.html#quick-example)

## Installation

### Cordova

```sh
cordova plugin add cordova-plugin-device
npm install @awesome-cordova-library/device
```

### Capacitor / Ionic

```bash
npm install cordova-plugin-device
npm install @awesome-cordova-library/device
npx cap sync
```

## Vanilla

### Declaration

```typescript
class Device {
  static getModel(): string;
  static getPlatform(): string;
  static getVersion(): string;
  static getUuid(): string | null;
  static getManufacturer(): string | null;
  static getIsVirtual(): boolean;
}
```

### Usages

```typescript
import Device from "@awesome-cordova-library/device";

Device.getModel();
Device.getPlatform();
Device.getVersion();
Device.getUuid();
Device.getManufacturer();
Device.getIsVirtual();
```

## React

### Declartion

```typescript
const useDevice: () => {
  getModel: () => string;
  getPlatform: () => string;
  getUuid: () => string | null;
  getVersion: () => string | null;
  getManufacturer: () => string | null;
};
```

### Usages

```typescript
import { useEffect } from "react";
import useDevice from "@awesome-cordova-library/device/lib/react";

function App() {
  const { getModel, getPlatform, getUuid, getVersion, getManufacturer } =
    useDevice();

  useEffect(() => {
    getModel();
    getPlatform();
    getUuid();
    getVersion();
    getManufacturer();
  }, []);
}
```

---
_Source: https://npm.io/package/@awesome-cordova-library/device · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
