Web Push Notifications Java API 3.0.0 | Unable to create notification with custom icon, title and OpenExternalURLAction at the same time

Hi Guys,

I didn't find a way how to create Urban Airship WEB push notification with custom icon, alert, title and external url action at the same time. I'm using Java API 3.0.0

https://docs.urbanairship.com/reference/libraries/java/3.0.0/

 

WebDevicePayload gives ability to set title, alert and icon but there is no ability to add option of external url opening action.

Notification class have ability to add external url opening action, but doesn't provide ability to customize icon and title of push notification.

 

Any ideas, Guys, how this can be solved via Java API ?

Thanks in advance

Didn't find what you were looking for?

New post

Comments

1 comment

  • Hi Aleh,

    We may have just answered this in a ticket from your team, but we wanted to reply here for others to see if they had similar questions.

    The WebDevicePayload class would be used in this case to override default notification settings, but you can use it simultaneously with Actions and Notifications classes. Please see the example below:

    WebDevicePayload webPayload = WebDevicePayload.newBuilder()
     .setAlert("This is the big news!")
     .setTitle("Big news!");

    Actions openURL = Actions.newBuilder()
     .setOpen(new OpenExternalURLAction(new URI("https://www.google.com")))
     .build();

    Notification notification = Notification.newBuilder()
     ...
     .setActions(openURL)
     .addDeviceTypeOverride(DeviceType.WEB, webPayload)
     .build();

    PushPayload payload = PushPayload.newBuilder()
     ...
     .setNotification(notification)
     .build();

    Hope this helps!

    Alana | Technical Support Engineer

    Comment actions Permalink

Please sign in to leave a comment.