1

Most of you must have used "whatsapp" and "viber". These apps constantly keep running even when they are exited. I want one of my activities to keep running in the background after its being ran for the first time. And I also want the whole app to keep running in the background like viber and whatsapp do. How can I do that?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Mohammad Sohaib
  • 577
  • 3
  • 11
  • 28

2 Answers2

3

Use service. Read this and this about details of service.

You can keep your activity running in the background. But I think it is definitely a better idea to keep a service running in the background. You will get a basic idea about the service by reading above two links.

Siv
  • 1,026
  • 19
  • 29
stinepike
  • 54,068
  • 14
  • 92
  • 112
3

It's not the Activity that keeps running in the background but a Service. Look at http://developer.android.com/reference/android/app/Service.html for implementing it.

deekay
  • 681
  • 4
  • 17