How to prevent an android activity to get killed

后端 未结 3 1159
闹比i
闹比i 2020-12-22 07:21

I have developed an application that does require to do constant network activity. This Activity does the network connections thru an AsyncTask, sometime this work being do

相关标签:
3条回答
  • 2020-12-22 07:39

    Does your application have to be an activity? Can it utilize a background service?

    http://developer.android.com/reference/android/app/Service.html#ServiceLifecycle

    0 讨论(0)
  • 2020-12-22 07:43

    If you use a Service and make sure it stays active (by first starting it and simply not stopping it) the application wont be killed (unless it's extremely low on memory of course).

    0 讨论(0)
  • 2020-12-22 07:55

    You should use a service instead of using an Activity to do work in the background.

    0 讨论(0)
提交回复
热议问题