|
|
|
@ -13,7 +13,14 @@ import org.tasks.notifications.NotificationManager;
|
|
|
|
|
|
|
|
|
|
public abstract class InjectingService extends Service {
|
|
|
|
|
|
|
|
|
|
private CompositeDisposable disposables = new CompositeDisposable();
|
|
|
|
|
private CompositeDisposable disposables;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onCreate() {
|
|
|
|
|
super.onCreate();
|
|
|
|
|
|
|
|
|
|
startForeground(getNotificationId(), buildNotification());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
|
|
@ -21,11 +28,12 @@ public abstract class InjectingService extends Service {
|
|
|
|
|
|
|
|
|
|
inject(((InjectingApplication) getApplication()).getComponent().plus(new ServiceModule()));
|
|
|
|
|
|
|
|
|
|
disposables.add(
|
|
|
|
|
Completable.fromAction(this::doWork)
|
|
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
.subscribe(this::stopSelf));
|
|
|
|
|
disposables =
|
|
|
|
|
new CompositeDisposable(
|
|
|
|
|
Completable.fromAction(this::doWork)
|
|
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
.subscribe(this::stopSelf));
|
|
|
|
|
|
|
|
|
|
return Service.START_NOT_STICKY;
|
|
|
|
|
}
|
|
|
|
|