Android camera light flashes when phone rings

For this you should do like :

If yes then Turn Off/On

If no then you can do whatever according to your app. needs

For Checking availability of flash in device:

You can use the following

which will return true if a flash is available, false if not.

For turning on/off flashlight :

I googled out and got this about android.permission.FLASHLIGHT. Android manifests' permission looks promising:

Android camera light flashes when phone rings

Code Snippet to turn on camera flash light.

Code snippet to turn off camera led light.

I just found a project that uses this permission. Check quick-settings' src code. here code.google/p/quick-settings/ (Note: This link is now broken)

ads

Update6 You could also try to add a SurfaceView as described in this answer LED flashlight on Galaxy Nexus controllable by what API? This seems to be solution that works on many phones.

Update 5 Major Update

I have found alternate Link(for above broken links): java2s/Open-Source/Android/Tools/quick-settings/com.bwx.bequick.flashlight.htm You can now use this link. [Update. 14/9/2012 This link is now broken]

Example showing how to enable the LED on a Motorola Droid. code.google/p/droidled/

Another Open Source Code.

Update 3 (Widget for turning on/off camera led)

If you want to develop a widget that turns on/off your camera led, then you must refer my answer Widget for turning on/off camera flashlight in android.

If you want to set intensity of light emerging from camera LED you can refer Can I change the LED intensity of an Android device? full post. Note that only rooted HTC devices support this feature.

There are also some problems while turning On/Off flashlight. eg. for the devices not having FLASH_MODE_TORCH or even if it has, then flashlight doesnot turn ON etc.

Typically Samsung creates alot of problems.

Related posts

  • Julia Welling For once in their lives, Android users have one up on the iPhone . Japanese toy maker, Takama Tomy Arts . just took nail art stickers to a whole new level, when the company...

  • Use Your Android Device’s Camera Flash As Notification For Incoming Calls With FlashBlink By Awais Imran | March 22nd, 2012 Smartphones of today are the ultimate example of the convergence of...

  • Vibrate then ring with flash for Windows Phone # Vibrate then ring with flash by shake * Feature phones as the primary function, but Android does not support basic Vibrate then ring camera...

  • How to Set Up the iPhone LED Flash for Alerts Feb 16th, 2013 10:30 AM EST | How-To I've mentioned in a previous article here on TMO, "How to Set Use 'Do Not Disturb' in iOS 6," that I'm a big...

  • How to monitor when your cell phone rings Here is a cheap and easy way to monitor via Homeseer when your Cell Phone rings while you are at home and have your cell phone sitting on your desk (it...