Skip to content

How to open application webView on message tap?

Olga Koroleva edited this page Nov 9, 2022 · 7 revisions

To provide url, that should be opened on notification tap or on in-app notification primary button tap, you can use API by specifying notificationOptions.primaryButtonAction as follows:

"notificationOptions": {
    "primaryButtonAction": {
        "resource": "http://someurl.com",
        "type": "WEB_VIEW_URL"
    }
}

Another option is by setting up Mobile Push Broadcast on Infobip portal, specifying action properties.

No additional coding is needed, but you could customize web view appearance.

Customize web view appearance

You can define your own custom theme for the webView in styles.xml and change action bar / toolbar and notification bar colors, colorPrimary and colorPrimaryDark respectively. Use IB_AppTheme.WebView name.

<resources>
    <style name="IB_AppTheme.WebView">
        <item name="colorPrimary">@color/colorPrimary</item> <!-- color of toolbar background -->
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <!-- color of status / notification bar -->
        <item name="colorControlNormal">@android:color/white</item> <!-- color of navigation icon in toolbar -->
        <item name="titleTextColor">@android:color/white</item> <!-- color of toolbar title text -->
    </style>
</resources>

Theme usage example you can find in our Firebase example application and Huawei example application, provided with SDK.

Clone this wiki locally