0

I have a service that runs an async task. Does the service call stopSelf() after the async task has finished?

Example Code:

public class BackgroundService extends Service {

 private final IBinder mBinder = new Binder();

 @Override
 public void onCreate() {
 }

 @Override
 public int onStartCommand(Intent intent, int flags, int startId) {
     new AsyncMethod().execute();
     return START_STICKY;
 }

 @Override
 public IBinder onBind(Intent intent) {
     return mBinder;
 }
}
  • You can call it in onPostExecute(); – blackapps May 26 '21 at 08:45
  • @mrek No, but that did lead me to [this](https://stackoverflow.com/questions/2176375/service-wont-stop-when-stopservice-method-is-called/2176415#2176415) which did answer it. Thanks for the help. – Adam Davies May 27 '21 at 07:32

0 Answers0