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
  • 11,360
  • 21
  • 88
  • 132
Mohammad Sohaib
  • 567
  • 3
  • 10
  • 25

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
  • 971
  • 17
  • 28
stinepike
  • 52,673
  • 14
  • 90
  • 109
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
  • 8
  • 16