Skip to content

Commit 5209771

Browse files
committed
Add badge to notifications
1 parent 39546fb commit 5209771

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Notification notification = pushpad.buildNotification("Title", "Message", "https
4848

4949
// optional, defaults to the project icon
5050
notification.iconUrl = "https://example.com/assets/square-icon.png";
51+
// optional, defaults to the project badge
52+
notification.badgeUrl = "https://example.com/assets/badge.png";
5153
// optional, an image to display in the notification content
5254
notification.imageUrl = "https://example.com/assets/image.png";
5355
// optional, drop the notification after this number of seconds if a device is offline

src/xyz/pushpad/Notification.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class Notification {
1515
public String title;
1616
public String targetUrl;
1717
public String iconUrl;
18+
public String badgeUrl;
1819
public String imageUrl;
1920
public Integer ttl;
2021
public Boolean requireInteraction;
@@ -67,6 +68,9 @@ private String reqBody(String[] uids, String[] tags) {
6768
if (this.iconUrl != null) {
6869
notificationData.put("icon_url", this.iconUrl);
6970
}
71+
if (this.badgeUrl != null) {
72+
notificationData.put("badge_url", this.badgeUrl);
73+
}
7074
if (this.imageUrl != null) {
7175
notificationData.put("image_url", this.imageUrl);
7276
}

0 commit comments

Comments
 (0)