protected WorkerThread workerThread;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (this.looperThread.isAlive()) {
this.looperThread.start(); }
return Service.START_STICKY;
}
public class MyService extends IntentService {
public MyService() {
super("Cashback IntentService");
}
@Override
protected void onHandleIntent(Intent intent) {
....Your code that is to be executed in background goes here
}
}