I have developed an application which take image from front camera after every 30 seconds. When I press the back button my application stops. I want to run my application in background and I have no idea how to do it. Any help will be appreciated..
3 Answers
You can use an IntentService. It runs on a background thread and is not affected by UI lifecycles. You can reach about how to use it here in the Android Developer Docs

- 11
- 2
You should read these documents about Services on Android.and put those codes on what you need to be run on background as a service.that's all.
A Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application. Additionally, a component can bind to a service to interact with it and even perform interprocess communication (IPC). For example, a service might handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background.

- 16,646
- 7
- 53
- 108
You could look into the following links below.
Another Stack Overflow question asking the same thing: How to run an android app in background? Android Development Documents for running background services: http://developer.android.com/training/run-background-service/index.html
Hope this helps.