From f99bfe897f9cc1d9d309d16047b67509079785b5 Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Thu, 9 Mar 2023 10:20:51 -0500 Subject: [PATCH] add time feature --- README.md | 1 + .../com/zinspector/foregroundservice/NotificationHelper.java | 2 ++ index.js | 1 + 3 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 1c697a9..59c7366 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ https://github.com/zo0r/react-native-push-notification/ message: `blah message`, visibility: 'public', importance: 'low', + time: true, number: String(1) }; diff --git a/android/src/main/java/com/zinspector/foregroundservice/NotificationHelper.java b/android/src/main/java/com/zinspector/foregroundservice/NotificationHelper.java index 2a68b74..20978fc 100755 --- a/android/src/main/java/com/zinspector/foregroundservice/NotificationHelper.java +++ b/android/src/main/java/com/zinspector/foregroundservice/NotificationHelper.java @@ -149,6 +149,8 @@ Notification buildNotification(Context context, Bundle bundle) { } } + notificationBuilder.setShowWhen(bundle.getBoolean("time")); + return notificationBuilder.build(); } diff --git a/index.js b/index.js index fc55fb2..8a43aed 100644 --- a/index.js +++ b/index.js @@ -17,6 +17,7 @@ const ForegroundServiceEmitter = ForegroundServiceModule * @property {string} icon - Small icon name | ic_notification * @property {string} largeIcon - Large icon name | ic_launcher * @property {string} visibility - private | public | secret + * @property {string} time - Show time on notification | false * @property {boolean} ongoing - true/false if the notification is ongoing. The notification the service was started with will always be ongoing * @property {number} [importance] - Importance (and priority for older devices) of this notification. This might affect notification sound One of: * none - IMPORTANCE_NONE (by default),