aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Notifications.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
index 0d4a0f9c..d6a92b07 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
@@ -99,7 +99,12 @@ public final class Notifications {
public void run() {
downloadService.stopForeground(true);
showDownloadingNotification(context, downloadService, handler, downloadService.getCurrentDownloading(), downloadService.getBackgroundDownloads().size());
- downloadService.startForeground(NOTIFICATION_ID_PLAYING, notification);
+
+ try {
+ downloadService.startForeground(NOTIFICATION_ID_PLAYING, notification);
+ } catch(Exception e) {
+ Log.e(TAG, "Failed to start notifications after stopping foreground download");
+ }
}
});
} else {
@@ -107,13 +112,22 @@ public final class Notifications {
@Override
public void run() {
if (playing) {
- downloadService.startForeground(NOTIFICATION_ID_PLAYING, notification);
+ try {
+ downloadService.startForeground(NOTIFICATION_ID_PLAYING, notification);
+ } catch(Exception e) {
+ Log.e(TAG, "Failed to start notifications while playing");
+ }
} else {
playShowing = false;
persistentPlayingShowing = true;
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
downloadService.stopForeground(false);
- notificationManager.notify(NOTIFICATION_ID_PLAYING, notification);
+
+ try {
+ notificationManager.notify(NOTIFICATION_ID_PLAYING, notification);
+ } catch(Exception e) {
+ Log.e(TAG, "Failed to start notifications while paused");
+ }
}
}
});