System


#Overview

The System API provides access to basic system functions like flashlight control and platform detection.

Import
Copied!
use Native\Mobile\Facades\System;
Copied!
import { system } from '#nativephp';
// or import individual functions
import { isIos, isAndroid, isMobile } from '#nativephp';

#Methods

#flashlight() - Deprecated, see Device

Toggles the device flashlight (camera flash LED) on and off.

Returns: void

Toggle Flashlight
Copied!
System::flashlight(); // Toggle flashlight state
Copied!
// Use device.flashlight() instead
import { device } from '#nativephp';
 
await device.flashlight();

#isIos()

Determines if the current device is running iOS.

Returns: true if iOS, false otherwise

Check iOS
Copied!
if (System::isIos()) {
// iOS-specific code
}
Copied!
const ios = await system.isIos();
 
if (ios) {
// iOS-specific code
}

#isAndroid()

Determines if the current device is running Android.

Returns: true if Android, false otherwise

Check Android
Copied!
if (System::isAndroid()) {
// Android-specific code
}
Copied!
const android = await system.isAndroid();
 
if (android) {
// Android-specific code
}

#isMobile()

Determines if the current device is running Android or iOS.

Returns: true if Android or iOS, false otherwise

Check Mobile Platform
Copied!
if (System::isMobile()) {
// Mobile-specific code
}
Copied!
const mobile = await system.isMobile();
 
if (mobile) {
// Mobile-specific code
}