Use ServiceCompat.stopForeground().
This commit is contained in:
parent
467dacd35a
commit
0fe3fe7594
5 changed files with 11 additions and 6 deletions
|
|
@ -30,6 +30,7 @@ import android.os.IBinder
|
|||
import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.app.ServiceCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.core.Flowable
|
||||
|
|
@ -147,7 +148,7 @@ class FeedLoadService : Service() {
|
|||
|
||||
private fun stopService() {
|
||||
disposeAll()
|
||||
stopForeground(true)
|
||||
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
||||
notificationManager.cancel(NOTIFICATION_ID)
|
||||
stopSelf()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import androidx.annotation.Nullable;
|
|||
import androidx.annotation.StringRes;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.app.ServiceCompat;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.schabi.newpipe.R;
|
||||
|
|
@ -162,7 +163,7 @@ public abstract class BaseImportExportService extends Service {
|
|||
|
||||
protected void postErrorResult(final String title, final String text) {
|
||||
disposeAll();
|
||||
stopForeground(true);
|
||||
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE);
|
||||
stopSelf();
|
||||
|
||||
if (title == null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue