I created a simple webview to receive notifications from OneSignal, I send the notification with

'data' => array ("launchURL" => $link),

But I'm not sure how to handle this link sent in data

How do I open the $link sent via onesignal directly in the URL of my webview?

public class ApplicationClass extends Application {

    public void onCreate() {
                .setNotificationOpenedHandler(new ExampleNotificationOpenedHandler())

class ExampleNotificationOpenedHandler implements OneSignal.NotificationOpenedHandler {
    // This fires when a notification is opened by tapping on it and
    // puts the launchURL additional data into a string for use in the main activity
    public static String launchURL;

    public void notificationOpened(OSNotificationOpenResult result) {
        OSNotificationAction.ActionType actionType = result.action.type;
        JSONObject data = result.notification.payload.additionalData;
        if (data != null) {
            launchURL = data.optString("launchURL", null);

0 Answers