2

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..

Osama Naveed
  • 126
  • 1
  • 1
  • 8

3 Answers3

1

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

Navdeep
  • 11
  • 2
0

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,177
  • 7
  • 51
  • 106
0

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.

Community
  • 1
  • 1
Mohit G
  • 195
  • 1
  • 1
  • 14