Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit a4b4de9

Browse files
authored
Merge pull request #1519 from adrian-chojecki/master
[ANDROID] Add support for setOnlyAlertOnce property
2 parents b1f6474 + 3b10362 commit a4b4de9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ PushNotification.localNotification({
323323
ignoreInForeground: false, // (optional) if true, the notification will not be visible when the app is in the foreground (useful for parity with how iOS notifications appear)
324324
shortcutId: "shortcut-id", // (optional) If this notification is duplicative of a Launcher shortcut, sets the id of the shortcut, in case the Launcher wants to hide the shortcut, default undefined
325325
channelId: "your-custom-channel-id", // (optional) custom channelId, if the channel doesn't exist, it will be created with options passed above (importance, vibration, sound). Once the channel is created, the channel will not be update. Make sure your channelId is different if you change these options. If you have created a custom channel, it will apply options of the channel.
326-
326+
onlyAlertOnce: false, //(optional) alert will open only once with sound and notify, default: false
327+
327328
actions: '["Yes", "No"]', // (Android only) See the doc for notification actions to know more
328329
invokeApp: true, // (optional) This enable click on actions to bring back the application to foreground or stay in background, default: true
329330

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
314314
.setTicker(bundle.getString("ticker"))
315315
.setVisibility(visibility)
316316
.setPriority(priority)
317-
.setAutoCancel(bundle.getBoolean("autoCancel", true));
317+
.setAutoCancel(bundle.getBoolean("autoCancel", true))
318+
.setOnlyAlertOnce(bundle.getBoolean("onlyAlertOnce", false));
318319

319320
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { // API 24 and higher
320321
// Restore showing timestamp on Android 7+

0 commit comments

Comments
 (0)