Question

I am making a Flashlight app, currently its widget. I was wondering how would I emulate functionality of samsungs assistive light widget (http://www.youtube.com/watch?v=PYR9jqo0vvc&feature=player_embedded#!)?

If I turn my light on, the camera app is not going to work, however with this widget, samsung made it somehow work. I have no idea at all, for all I know Camera.open() locks the camera to the process, so Camera app cannot access it.

Thanks.

Was it helpful?

Solution

The standard Android camera API does not allow for setting the flash to torch mode, and then allowing some other application to use the camera. If the Flashlight app does not release the camera, then the standard camera app cannot work. If the Flashlight app does release the camera, then the flash will turn off.

Samsung must have extended the Android APIs with a custom feature to enable/disable the torch mode without requiring locking the camera. If they wish, they could document this additional capability, but presumably the added APIs only exist on the Galaxy S3 or other similar Samsung devices; it would not allow you to write code that works on all Android devices.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top