Skip to content

Commit 4aba3ad

Browse files
committed
Create device.md
1 parent 5d97313 commit 4aba3ad

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Device
3+
order: 200
4+
---
5+
6+
## Overview
7+
8+
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.
9+
```php
10+
use Native\Mobile\Facades\Device;
11+
```
12+
13+
## Methods
14+
15+
### `getId()`
16+
17+
Return a unique identifier for the device.
18+
19+
Returns: `string`
20+
21+
### `getInfo()`
22+
23+
Return information about the underlying device/os/platform.
24+
25+
Returns JSON encoded: `string`
26+
27+
28+
### `getBatteryInfo()`
29+
30+
Return information about the battery.
31+
32+
Returns JSON encoded: `string`
33+
34+
## Device Info
35+
36+
| Prop | Type | Description
37+
|---|---|---|---|
38+
| name | string | The name of the device. For example, "John's iPhone". On iOS 16+ this will return a generic device name without the appropriate entitlements.
39+
| model | string | The device model. For example, "iPhone13,4".
40+
| platform | 'ios' \| 'android' | The device platform (lowercase).
41+
| operatingSystem | string | The operating system of the device.
42+
| osVersion | string | The version of the device OS.
43+
| iOSVersion | number | The iOS version number. Only available on iOS. Multi-part version numbers are crushed down into an integer padded to two-digits, e.g., "16.3.1" → `160301`. | 5.0.0 |
44+
| androidSDKVersion | number | The Android SDK version number. Only available on Android. | 5.0.0 |
45+
| manufacturer | string | The manufacturer of the device.
46+
| isVirtual | boolean | Whether the app is running in a simulator/emulator.
47+
| memUsed | number | Approximate memory used by the current app, in bytes. Divide by 1,048,576 to get MBs used.
48+
| webViewVersion | string | The web view browser version.
49+
50+
## Battery Info
51+
52+
| Prop | Type | Description
53+
|---|---|---|---|
54+
| batteryLevel | number | A percentage (0 to 1) indicating how much the battery is charged.
55+
| isCharging | boolean | Whether the device is charging.

0 commit comments

Comments
 (0)