0

I am doing background process in my android application for that i used service.In iphone i use appdelegate for the background process.

My question is any other alternate methods to do the background process in andorid? If so which will be the best one?

Thanks.

codewithdk
  • 1,290
  • 1
  • 10
  • 23

1 Answers1

0

To perform background process in Android you have 3 best options:

1) Thread

2) Service

3) ASYCN task

All these three are for the same purpose for which you are looking.

To stop Thread:

In general, you don't forcibly stop threads because it's dangerous. You set a flag that tells the thread in question to exit from it's thread loop under controlled circumstances.

Your thread loop looks something along these lines:

void run() {
  while (shouldContinue) {
    doThreadWorkUnit();
  }
}

How to Stop Thread:

Community
  • 1
  • 1
Sam-In-TechValens
  • 2,501
  • 4
  • 34
  • 67