Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Set a number on the notification.
Not yet implemented.

**ongoing (`boolean`)**
Not yet implemented.
If set to true, the user will not be able to remove the notification. Defaults to `false`.

**category (`string`)**
Set the notification category, e.g.: `alarm`, `call`, `email`, `event`, `progress`, `reminder`, `social`. It may be used by the Android system for ranking and filtering.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public android.app.Notification build() {
.setContentText(attributes.message)
.setSmallIcon(context.getResources().getIdentifier(attributes.smallIcon, "mipmap", context.getPackageName()))
.setAutoCancel(attributes.autoClear)
.setOngoing(attributes.ongoing)
.setContentIntent(getContentIntent());


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class NotificationAttributes {
public String vibrate;
public String lights;
public Boolean autoClear;
public Boolean ongoing;
public Boolean onlyAlertOnce;
public String tickerText;
public Long when;
Expand Down Expand Up @@ -161,6 +162,8 @@ public void loadFromReadableMap(ReadableMap readableMap) {
if (readableMap.hasKey("lights")) lights = readableMap.getString("lights");
if (readableMap.hasKey("autoClear")) autoClear = readableMap.getBoolean("autoClear");
else autoClear = true;
if (readableMap.hasKey("ongoing")) ongoing = readableMap.getBoolean("ongoing");
else ongoing = false;
if (readableMap.hasKey("onlyAlertOnce")) onlyAlertOnce = readableMap.getBoolean("onlyAlertOnce");
if (readableMap.hasKey("tickerText")) tickerText = readableMap.getString("tickerText");
if (readableMap.hasKey("when")) when = Long.parseLong(readableMap.getString("when"));
Expand Down Expand Up @@ -232,6 +235,7 @@ public ReadableMap asReadableMap() {
if (vibrate != null) writableMap.putString("vibrate", vibrate);
if (lights != null) writableMap.putString("lights", lights);
if (autoClear != null) writableMap.putBoolean("autoClear", autoClear);
if (ongoing != null) writableMap.putBoolean("ongoing", ongoing);
if (onlyAlertOnce != null) writableMap.putBoolean("onlyAlertOnce", onlyAlertOnce);
if (tickerText != null) writableMap.putString("tickerText", tickerText);
if (when != null) writableMap.putString("when", Long.toString(when));
Expand Down
1 change: 1 addition & 0 deletions index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ function encodeNativeNotification(attributes) {
if (!attributes.action) attributes.action = 'DEFAULT';
if (!attributes.payload) attributes.payload = {};
if (attributes.autoClear === undefined) attributes.autoClear = true;
if (attributes.ongoing === undefined) attributes.ongoing = false;
if (attributes.tickerText === undefined) {
if (attributes.subject) {
attributes.tickerText = attributes.subject + ': ' + attributes.message;
Expand Down