B4X FEED Camera2Torch - Torch using B4A's Camera2 library

اطلاعات موضوع

درباره موضوع در تاریخ, در دسته b4xfeed ایجاد شده و آغاز کننده آن PracticalBotمی باشد و موضوع آن: Camera2Torch - Torch using B4A's Camera2 library است. این موضوع تا کنون 45 بازدید کننده و, 0 پاسخ داشته و 0 بار پسندیده شده...
نام دسته b4xfeed
نام موضوع Camera2Torch - Torch using B4A's Camera2 library
آغاز کننده موضوع PracticalBot
تاریخ شروع
پاسخ‌ها
0
بازدیدها
45
پسندها
0
آخرین ارسال توسط PracticalBot

PracticalBot

ربات انجمن کاربردی
کاربر(جدید)
Dec 12, 2022
357
2
Attached is the class Camera2Torch. It uses B4A's Camera2 library to use Android's CameraManager's setTorchMode method. Please note that this method is only available since API23, whereas CameraManager is available as of API21.

This has been successfully tested (via sideloading, targetSdkVersion="30") on the following:
  • Pixel 7 running Android 13
  • Chinese phone running Android 11
  • Chinese phone running Android 6
I'm also attaching a bare-bones test application (a B4XPages skeleton app with minimum add-on code to allow turning the rear camera torch on and off).

Note:

With sideloading the app, no additional Manifest entries seem to be required, nor do I need to ask the user for permission to use the camera. I do not know if this changes for apps on Google's Play Store. Various internet posts on the subject of the usage of setTorchMode have the additional Manifest entries
  • AddPermission("android.permission.FLASHLIGHT")
  • AddManifestText(<uses-feature...



 

عقب
بالا