aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-10-01 21:05:35 -0700
committerScott Jackson <daneren2005@gmail.com>2016-10-01 21:05:35 -0700
commit3f3f850ea8328d5846d0e3ae8f600e8068f20ba6 (patch)
tree9d4acee969244288a5ce085c8816026040cb5d1c /app/src/main/java
parent0a69ab05e483b8ca5c51873b52e352e1816da1f4 (diff)
downloaddsub-3f3f850ea8328d5846d0e3ae8f600e8068f20ba6.tar.gz
dsub-3f3f850ea8328d5846d0e3ae8f600e8068f20ba6.tar.bz2
dsub-3f3f850ea8328d5846d0e3ae8f600e8068f20ba6.zip
Workaround for #739
Diffstat (limited to 'app/src/main/java')
-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");
+ }
}
}
});