切换设备的手电筒/手电筒。
npm install @capgo/capacitor-flash
npx cap sync
开箱即用
AndroidManifest.xml
文件中声明权限
< uses-permission android : name = " android.permission.CAMERA " android : maxSdkVersion = " 23 " />
< uses-permission android : name = " android.permission.FLASHLIGHT " />
< uses-feature android : name = " android.hardware.camera.flash " android : required = " true " />
isAvailable()
switchOn(...)
switchOff()
isSwitchedOn()
toggle()
isAvailable ( ) = > any
检查手电筒是否可用
返回: any
switchOn ( options : { intensity ?: number ; } ) = > any
打开手电筒
参数 | 类型 |
---|---|
options | { intensity?: number; } |
返回: any
switchOff ( ) = > any
关闭手电筒
返回: any
isSwitchedOn ( ) = > any
检查手电筒是否打开或关闭
返回: any
toggle ( ) = > any
切换手电筒
返回: any