flashlight

Can I change the LED intensity of an Android device?

安稳与你 提交于 2019-12-17 05:54:07
问题 Is there a way to set the LED intensity that I desire? I know that to turn on the LED I use: p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); mycam.setParameters(p); But this code just turns on the LED. But is there a way to set different intensities to the LED for a stronger light or to reduce the light intensity? 回答1: HTC has an alternative API that supports this, however it's only on HTC Sense devices, and as of Gingerbread they've changed the permissions so it's only for their

Can I change the LED intensity of an Android device?

ぃ、小莉子 提交于 2019-12-17 05:54:05
问题 Is there a way to set the LED intensity that I desire? I know that to turn on the LED I use: p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); mycam.setParameters(p); But this code just turns on the LED. But is there a way to set different intensities to the LED for a stronger light or to reduce the light intensity? 回答1: HTC has an alternative API that supports this, however it's only on HTC Sense devices, and as of Gingerbread they've changed the permissions so it's only for their

LED flashlight on Galaxy Nexus controllable by what API?

岁酱吖の 提交于 2019-12-17 03:08:15
问题 So many LED flashlight API questions for Android. I'm afraid to ask yet another, but here goes.. Using the tried and true FLASH_MODE_TORCH I am able to achieve satisfaction with my Samsung Galaxy SII and get the LED flash turned on. On my friend's Galaxy Nexus, no such luck. Nor on my other friend's Droid X. I'm noticing for a not insignificant number of devices specific native IOCTL calls seem to be required. Is this the case for the Galaxy Nexus? How do I find a reference to program it? I

iPhone X Flashlight turns off when AR Camera is enabled

孤人 提交于 2019-12-14 03:47:20
问题 I am building an AR app that needs the flashlight to be turned on torch mode. Turning on torch mode and then enabling the AR scene works fine on my iPhone 8, but on the iPhone X, it the flashlight turns on and then off again. Is there some way around this, or something specific I have to do for the iPhone X to work? - (void)turnTorchOn:(bool) on { Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice"); if (captureDeviceClass != nil) { AVCaptureDevice *device = [AVCaptureDevice

Set brightness of flash in Android

十年热恋 提交于 2019-12-13 08:18:59
问题 In my program I tested this: try { FileWriter mWriter = new FileWriter("/sys/class/leds/flashlight/brightness"); mWriter.write(125); mWriter.flush(); } catch (Exception e) { Log.e(TAG, "setFlashlightEnabled failed", e); } I have this in the log : 01-13 14:56:30.578: E/test(603): setFlashlightEnabled failed 01-13 14:56:30.578: E/test(603): java.io.FileNotFoundException: /sys/class/leds/flashlight/brightness (Permission denied) 01-13 14:56:30.578: E/test(603): at org.apache.harmony.luni

android flash turn on/off using button while camera is running

醉酒当歌 提交于 2019-12-12 18:35:14
问题 I saw that there are many questions liek this but I didn't find any way. In my app I have my own Camera with some options , and also have button named btnFlash for turning on/off camera's flash light while camera is running. I tried many ways, but nothing worked as on Samsung tab and HTC. here is one of them ImageButton btnFlash = (ImageButton) findViewById(R.id.btn_flash); btnFlash.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Context context =

flashlight not working,when device screen is off/sleep (android studio)

試著忘記壹切 提交于 2019-12-12 02:09:48
问题 i created a flashlight application,flashlight working. but flashlight not work when device screen power is off/sleep. i want flashlight continue on ,when device screen in off/sleep.. i am new for this site, i don't know,how upload full code, so i upload code in my blog site manifest code <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"

Flashlight app getting closed in background

孤街醉人 提交于 2019-12-11 23:43:49
问题 I am developing a flashlight app and the thing is that the app is working as expected, but not when "home" or "back" key is pressed. i want my app to keep the torch light on even when the user presses "Home" key so that user can do other works while torch is on. On back key, the flash turning off is fine. Here is my code. Please help me with it, thanx a lot to all. public class LightsOn extends Activity implements OnKeyListener { ImageView button; Boolean flashon=true; private boolean

android delaying flashlight

寵の児 提交于 2019-12-11 11:54:38
问题 I made a simple application with 2 buttons to test flashlights. button1.setOnClickListener...etc if (cameraObj ==null){ return; } Camera.Parameters cameraParams =cameraObj.getParameters(); if(cameraParams.getFlashMode() == null) { return;} cameraParams.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); cameraObj.setParameters(cameraParams); cameraObj.startPreview(); button2.setOnClick etc... if(cameraObj==null){ return; } Camera.Parameters cameraParams = cameraObj.getParameters(); cameraParams

Flashlight with strobe: turn flashlight ON when wheel view value is start from 1 to 10 then thread is not stop on zero value

白昼怎懂夜的黑 提交于 2019-12-11 10:32:29
问题 When the strobe value is increased from 1 to 10 the blinking of flashlight will never stop.neither it stops on zero nor it turns on beside it just get blinking and blinking constantly. here i am adding the code which i have written to do so. if someone knows the solutions please help me. Thread is not stop thread works until you stop debugger.. cheers! enter code here flashButton = findViewById(R.id.flash_button); mCameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE); try