From 79e8150d3e6f66b7f5479b0bd3550ecb14bf3b8a Mon Sep 17 00:00:00 2001 From: Nathan Kerr Date: Mon, 4 Feb 2019 13:57:06 -0800 Subject: [PATCH] Option to turn off notification timer Android notifications have a "how long ago was this notification set" timer. Now there's an option to turn that off (the default is true, so it's shown, matching current behavior). --- README.md | 3 ++- src/android/ForegroundService.java | 3 ++- www/background-mode.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5b728a1..77c0e98 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,8 @@ cordova.plugins.backgroundMode.setDefaults({ channelDescription: String, // Shown when the user views the channel's settings allowClose: Boolean, // add a "Close" action to the notification closeIcon: 'power', // An icon shown for the close action - closeTitle: 'Close' // The text for the close action + closeTitle: 'Close', // The text for the close action + showWhen: Boolean //(Default: true) Show the time since the notification was created }) ``` diff --git a/src/android/ForegroundService.java b/src/android/ForegroundService.java index 0e3a34c..423c99c 100644 --- a/src/android/ForegroundService.java +++ b/src/android/ForegroundService.java @@ -199,7 +199,8 @@ public class ForegroundService extends Service { .setContentTitle(title) .setContentText(text) .setOngoing(true) - .setSmallIcon(getIconResId(settings)); + .setSmallIcon(getIconResId(settings)) + .setShowWhen(settings.optBoolean("showWhen", true)); if (!subText.equals("")) { notification.setSubText(subText); diff --git a/www/background-mode.js b/www/background-mode.js index 34495ab..d8b8180 100644 --- a/www/background-mode.js +++ b/www/background-mode.js @@ -395,7 +395,8 @@ exports._defaults = { channelDescription: 'cordova-plugin-background-moden notification', allowClose: false, closeIcon: 'power', - closeTitle: 'Close' + closeTitle: 'Close', + showWhen: true }; /**