Skip to content

Commit 000e47d

Browse files
Fix bugs
1 parent c174100 commit 000e47d

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

app/src/main/java/com/onesignal/sample/android/NotificationServiceExtension.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ public class NotificationServiceExtension implements INotificationServiceExtensi
3030

3131
@Override
3232
public void onNotificationReceived(INotificationReceivedEvent event) {
33+
3334
IDisplayableMutableNotification notification = event.getNotification();
3435
Context context = event.getContext();
3536
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
3637
createNotificationChannels(notificationManager);
37-
JSONObject liveNotificationPayload = Objects
38-
.requireNonNull(notification.getAdditionalData())
39-
.optJSONObject("live_notification");
38+
JSONObject additionalData = notification.getAdditionalData();
39+
if (additionalData == null) return;
40+
JSONObject liveNotificationPayload = additionalData.optJSONObject("live_notification");
4041

4142
if (liveNotificationPayload == null) {
4243
return;
File renamed without changes.

testing/another_ln renamed to testing/start_live_notification.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ curl -X POST "https://onesignal.com/api/v1/notifications" \
1414
"headings": {"en": "You should see some text"},
1515
"data": {
1616
"live_notification": {
17-
"key": "another",
17+
"key": "progress",
1818
"event": "start",
19-
"immutable_attributes": {},
20-
"initial_attributes": {},
19+
"event_attributes": {},
2120
"event_updates": {}
2221
}
2322
}
File renamed without changes.

0 commit comments

Comments
 (0)