From 5bc07f17fbb6b20740dfd6077330815d6f8e1a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Thu, 26 Jan 2017 14:45:01 +0100 Subject: [PATCH] Add hidden flag - Fixes #224 --- CHANGELOG.md | 2 +- src/android/ForegroundService.java | 5 ++++- www/background-mode.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ab35de..859205f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ - Other apps audio interruption on iOS - __Changes__ - Deprecate event callbacks - - Notification not visible anymore on lock screen + - Notification not visible by default on lock screen - Remove ticker property on Android - Remove unexpected back button handler - Remove support for wp8 platform diff --git a/src/android/ForegroundService.java b/src/android/ForegroundService.java index f77dfb2..76cf918 100644 --- a/src/android/ForegroundService.java +++ b/src/android/ForegroundService.java @@ -165,9 +165,12 @@ public class ForegroundService extends Service { .setContentTitle(title) .setContentText(text) .setOngoing(true) - .setPriority(Notification.PRIORITY_MIN) .setSmallIcon(getIconResId(settings)); + if (settings.optBoolean("hidden", true)) { + notification.setPriority(Notification.PRIORITY_MIN); + } + if (bigText || text.contains("\n")) { notification.setStyle( new Notification.BigTextStyle().bigText(text)); diff --git a/www/background-mode.js b/www/background-mode.js index b06c274..d6c3b28 100644 --- a/www/background-mode.js +++ b/www/background-mode.js @@ -336,10 +336,10 @@ exports._isActive = false; exports._defaults = { title: 'App is running in background', text: 'Doing heavy tasks.', - ticker: 'Running in background', bigText: false, resume: true, silent: false, + hidden: true, color: undefined, icon: 'icon' };