flashlight

Blinking Flash according to Morse Code- Android. How to avoid ANRs due to sleeping ? (Torch App)

╄→尐↘猪︶ㄣ 提交于 2019-12-11 07:58:40
问题 So, I made a torch app... The normal Torch function is fully working, no problems. The following explains the below function that can cause possible ANRs Say, I want to send out an SOS message (morse code) through the blinking flash. (its 111-000-111) So it's On-On-On-Off-Off-Off- and repeat. (Read Slowly) I "On" it for a little while, then a little flash, "On" again - This is to distinguish two consecutive "On"s ... That's how I get three distinct flashes. Trouble is, for Time delay, I put

How to open device flashlight in Android N?

本小妞迷上赌 提交于 2019-12-11 05:27:43
问题 I'm trying to make a simple button that will turn on/off the device flashlight. I don't understand why android.hardware.camera is obsolete. What do I have to do in order to make my code working on all devices and also ones with older version of Android ? This is my code: if (IsFlashlightOn) { if (getPackageManager().hasSystemFeature( PackageManager.FEATURE_CAMERA_FLASH)) { cam = Camera.open(); Camera.Parameters p = cam.getParameters(); p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); cam

Is the flashlight intensity/brightness controllable on Android?

梦想的初衷 提交于 2019-12-11 04:28:45
问题 I am porting an existing iOS app to Android. In a special use case, the (iOS) app uses the flashlight to indicate different states of a progress to the user (as the screen must be facing down). It is switched on just for approx. 3 seconds for two times. To make clear the progress even more / make it easier to differ, we want the intensity/brightness of the flashlight to be lower / higher between the states. The iOS app does that, but there seems to be no official or reliable way to control

BlackBerry - Possible to Hide Video Field?

大憨熊 提交于 2019-12-10 15:08:46
问题 I want to write an application like a Flashlight (with the help of the camera LED). Player player = javax.microedition.media.Manager.createPlayer("capture://video?encoding=video/3gpp"); player.realize(); VideoControl videoControl = (VideoControl) player.getControl("VideoControl"); if(videoControl != null) { videoField = (Field)videoControl.initDisplayMode( VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field" ); try { videoControl.setDisplaySize(1, 1); } catch(Exception e) { PGLogUtil

how to implement button with flashlight blinking code in android studio

不想你离开。 提交于 2019-12-08 14:20:32
问题 i want to add flashlight Blinking mode in android studio with a button. but i don't know that how can i put a code and how to implement this code with a button. because i want that if i press button then flashlight start blinking. can anyone tell me that how can i implement this code with a button? String[] list1 = { "1", "0", "1", "0", "1", "0", "1", "0", "1", "0" }; for (int i = 0; i < list1.length; i++) { if (list1[i].equals("0")) { params.setFlashMode(Parameters.FLASH_MODE_ON); } else {

How turn on flashlight using Barcode Detection in Google Play services?

↘锁芯ラ 提交于 2019-12-08 00:44:23
问题 I'm trying to reimplement Redlaser barcode Scanner using Google play services. And face to the problem with flashlight. Android hardware.Camera object can't be using in common with CameraSource from gms.vision . Is there any opportunity to working with flashlight and Google barcode scanner? 回答1: Not sure I fully get what you're asking but my approach to this was to use the already created mCamerSource Object and setFlashMode() from there, this worked for me as I used a button to toggle the

app hanging on camera.release()

☆樱花仙子☆ 提交于 2019-12-07 15:08:45
问题 I'm working on a flashlight app using the camera flash. It seems to work fine but on occasion calling camera.release() causes a hang for about a minute or so. I've included the code below. I've looked at a bunch of examples and I don't see anything that could cause such a thing. Any ideas? //latest public void setOn(boolean on, Context context) { if (lock) { Log.i(TAG, "lock: true"); return; } if (on) { if (mCamera == null) { mCamera = Camera.open(); } Parameters params = mCamera

Android flashlight code not working

≯℡__Kan透↙ 提交于 2019-12-06 16:26:02
问题 I created a simple project to play with flashlight feature. From many different places (which all do it basically the same way), I have assembled the following code, but the flashlight will not turn on (No exceptions are raised) - but it works with the camera when I take a photo: Example code Example code 2 Example Code 3 @Override protected void onResume() { super.onResume(); try { // check flashlight support hasFlash = getApplicationContext().getPackageManager().hasSystemFeature

flash light is not turned on

这一生的挚爱 提交于 2019-12-06 08:17:49
This is my source code for barcode snanner which I post again. I edited my code. The problem is, when i run app, flash light is not turned on automatically. I added permission in manifest file, but flash light did not turn on. please help me where is the problem? I am using HTC wIldfire s mobile. public final class CameraManager { private static final String TAG = CameraManager.class.getSimpleName(); private static final int MIN_FRAME_WIDTH = 240; private static final int MIN_FRAME_HEIGHT = 240; private static final int MAX_FRAME_WIDTH = 480; private static final int MAX_FRAME_HEIGHT = 360;

Opening flashlight in android with different modes

♀尐吖头ヾ 提交于 2019-12-06 05:52:33
问题 Will the code as below work on android devices like Motorola razor who doesn't support torch? Can someone please be kind enough to test if has any phone like that and please tell me. Thanks in advance!! if (!isFlashOn) { if (camera == null || params == null) { return; } List<String> flashModes = params.getSupportedFlashModes(); if(flashModes.contains(Parameters.FLASH_MODE_TORCH)){ try { params = camera.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_TORCH); camera.setParameters