4

I have a flashlight app, and if the app is paused, the camera is released. Be it the home button or power button. I want the camera to stay alive when either of these are pressed and released when I close the app completely. How do I go about doing this?

1
  • By saying "close the app", does it include "killing the app"?
    – StarPinkER
    Mar 13, 2013 at 12:40

1 Answer 1

2

This is intended functionality to ensure you do not consume more power than necessary, and that other software on the device can obtain access to the camera on demand. Some useful information on the Activity lifecycle can be found here.

Generally, an Android developer's options are:

  1. Build a custom Android firmware that gives your app privileged access to the camera. This option is usually only really feasible if you are providing dedicated hardware, with this firmware and your app pre-installed.

  2. Approach your app design in a different way, that does not require the use of the camera when it is not in the foreground.

  3. Stick with the existing behaviour, and detail the caveats to the user on the market (and possibly as a first-time pop-up dialog to grab their attention) to reduce the number of complaints.

1
  • Thanks for the info. After messing around with my code and learning about activity life cycles, I managed to get my issue resolved.
    – Pazuzu156
    Oct 9, 2013 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.