cancel specific notifications instead of using cancelAll

This commit is contained in:
Akinwale Ariwodola 2018-09-02 17:54:37 +01:00
parent 0592c42df0
commit e8185e0f9c
3 changed files with 24 additions and 4 deletions
src/main/java/io/lbry/browser

View file

@ -38,6 +38,8 @@ import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
@ -66,6 +68,8 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
public static final String SETTING_KEEP_DAEMON_RUNNING = "keepDaemonRunning";
public static List<Integer> downloadNotificationIds = new ArrayList<Integer>();
/**
* Flag which indicates whether or not the service is running. Will be updated in the
* onResume method.
@ -294,7 +298,13 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
}
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.cancelAll();
notificationManager.cancel(BackgroundMediaModule.NOTIFICATION_ID);
notificationManager.cancel(DownloadManagerModule.GROUP_ID);
if (downloadNotificationIds != null) {
for (int i = 0; i < downloadNotificationIds.size(); i++) {
notificationManager.cancel(downloadNotificationIds.get(i));
}
}
super.onDestroy();
if (mReactInstanceManager != null) {