- Getting Started
- Architecture
- The Basics
- Digging Deeper
-
EDGE Components
- Introduction
- Activity Indicator
- Badge
- Bottom Navigation
- Bottom Sheet
- Button
- Button Group
- Canvas
- Carousel
- Checkbox
- Chip
- Column
- Divider
- Gesture Area
- Icon
- Icons
- Image
- Layout & Styling
- List
- Menus
- Modal
- Pressable
- Progress Bar
- Radio Group
- Row
- Scroll View
- Select
- Shapes
- Side Navigation
- Slider
- Spacer
- Stack
- Tab Row
- Text
- Text Input
- Toggle
- Top Bar
- Virtual List
- Web View
- Plugins
- Testing
- Publishing Your App
You're viewing pre-release documentation — version 4.x is in beta
Features, APIs and behaviour may change before the stable release. View the stable version (3.x)
Device
Overview#
The Device API exposes device hardware and information — vibration, the flashlight, a stable device
identifier, and device + battery details.
It's a core built-in: the facade resolves with nothing to install or register.
use Native\Mobile\Facades\Device;
Vibrate#
Trigger a short haptic tap:
$fired = Device::vibrate(); // bool — true if the haptic actually fired
On Android this uses the VIBRATE permission, which ships in the app manifest automatically. iOS needs no
permission.
Flashlight#
Toggle the rear flashlight on or off and read back the new state:
$result = Device::flashlight();// ['success' => true, 'state' => true] state: true = on, false = off
| Key | Type | Description |
|---|---|---|
success |
bool | Whether the toggle succeeded |
state |
bool | The flashlight state after toggling (true = on) |
On Android this uses the FLASHLIGHT permission, included in the manifest automatically.
Device identifier#
$id = Device::getId(); // ?string
A stable per-install identifier — identifierForVendor on iOS, ANDROID_ID on Android. Returns null when
called off-device (e.g. in tests or the web preview).
Device info#
getInfo() returns a JSON string, so decode it before use:
$info = json_decode(Device::getInfo(), true); $info['platform']; // 'ios' | 'android'$info['model']; // e.g. 'iPhone15,3'
| Field | Description |
|---|---|
name |
Device name |
model |
Device model identifier |
platform |
'ios' or 'android' |
operatingSystem |
OS name |
osVersion |
OS version string |
manufacturer |
Device manufacturer |
language |
Device language as a BCP 47 tag (e.g. en-US) |
isVirtual |
Whether running in a simulator/emulator |
memUsed |
Memory usage in bytes |
webViewVersion |
WebView version |
Battery#
getBatteryInfo() also returns a JSON string:
$battery = json_decode(Device::getBatteryInfo(), true); $battery['batteryLevel']; // 0.0 – 1.0$battery['isCharging']; // bool
| Field | Description |
|---|---|
batteryLevel |
Battery level from 0.0 to 1.0 |
isCharging |
Whether the device is charging |
Permissions#
| Platform | Permissions |
|---|---|
| Android | VIBRATE, FLASHLIGHT — merged into your manifest automatically |
| iOS | None |
in no time