как сказано в заголовке, я только что использовал разрешение FLASHLIGHT и вот мой код FLASHLIGHT [code]import android.annotation.SuppressLint import android.content.Context import android.hardware.camera2.CameraManager import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import kotlinx.coroutines.launch
class FlashlightHelper( var context: Context ) { private val manager = context.getSystemService(Context.CAMERA_SERVICE) as CameraManager private var cameraId: String? = null private var job: Job? = null
companion object { @SuppressLint("StaticFieldLeak") private var instance: FlashlightHelper? = null
fun getInstance( context: Context ): FlashlightHelper { if (instance == null) { instance = FlashlightHelper(context) } return instance!! } }