5

I have two applications that both use the camera:

  1. A flashlight app I have developed
  2. The camera app

The flashlight app opens the camera, turns on the flash, and runs in the background. However, if you start the camera app while the flashlight is on, there is an error in the camera app since the camera is already in use by the flashlight app:

Can't obtain device

In the flashlight app, how can I release the camera when another app requests it?

Sam
  • 40,644
  • 36
  • 176
  • 219
Alex
  • 51
  • 1
  • 3

1 Answers1

-1

Release it every time onPause is called. Call Camera.release() to release it. This will require you to request it again in onResume().

Looking Forward
  • 3,579
  • 8
  • 45
  • 65
Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • Flashlight application should support running in background. – Alex Feb 18 '14 at 07:34
  • please visit this site it solves all of your problem. http://stackoverflow.com/questions/6068803/how-turn-on-camera-flash-light-programmatically-in-android – Ahmad Arslan Feb 18 '14 at 07:37
  • Sorry, that's not what I wanted. I have two application, one is flashlight, other is camera,In flashlight application, set LED on, then pressed HOME KEY to back desktop, then open camera application, it prompt "Can't obtain device", how to auto close LED when I start camera application. – Alex Feb 18 '14 at 08:00