Skip to content

support for additional apns fields in the payload #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
29 changes: 29 additions & 0 deletions src/main/java/com/notnoop/apns/PayloadBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,35 @@ public PayloadBuilder category(final String category) {
}
return this;
}

/**
* Sets the alert to be specified as a String to display as the message text of the alert or banner.
* https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html#//apple_ref/doc/uid/TP40008194-CH17-SW1
*
* @return this
*/
public PayloadBuilder alert(final String alert) {
if (alert != null && !alert.trim().isEmpty()) {
aps.put("alert", alert);
}
return this;
}


/**
* Sets the extension notification type 'mutable-content' so that the client
* can let the OS know that they are not using the standard JSON format,
* rather a customised one which we will be parsed and let the OS know what contents needs to be shown.
* https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension#overview
*
* @return this
*/
public PayloadBuilder mutableContent(final boolean setMutableContent) {
if (setMutableContent) {
aps.put("mutable-content", 1);
}
return this;
}

/**
* Sets the notification badge to be displayed next to the
Expand Down