切換設備的手電筒/手電筒。
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