Skip to content

Commit

Permalink
Flash Python File Added
Browse files Browse the repository at this point in the history
  • Loading branch information
NILEG authored Jul 29, 2023
1 parent 1acac1e commit 3ef2dfc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions flash_python_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from jnius import autoclass, cast

class Flash:
CameraManager = autoclass('android.hardware.camera2.CameraManager')
Context=autoclass("android.content.Context")
context=Context()
camera_manager=cast("android.hardware.camera2.CameraManager",context.getSystemService(Context.CAMERA_SERVICE))
cameraid = camera_manager.getCameraIdList()[0]
@staticmethod
def on():
Flash.camera_manager.setTorchMode(Flash.cameraid, True)
@staticmethod
def off():
Flash.camera_manager.setTorchMode(Flash.cameraid, False)

0 comments on commit 3ef2dfc

Please sign in to comment.