WebAd
package com.intowow.sdk
public class WebAd

Overview
Web View Ad format helps you to insert the ad into the web view without latency. User can see varies kinds of ads in web view.
Characteristics
Zero latency loading in web view.
Support image and video.
Video is mute by default, and can be toggled by clicking it.
Integration
Before showing the ad on the web view, we need to setup the WebAd object. The WebAd object can help intowow SDK interact with the web view.
1. Initialize WebAd
Init the WebAd Object and register the object to the web view.
import com.intowow.sdk.WebAd;
private WebView mWebView = new WebView(context);
private WebAd mWebAd = new WebAd(context);
mWebAd.registerWebView(mWebView);
2. Check shouldInterceptRequest in WebViewClient
Override the shouldInterceptRequest and pass the intowow related url to intowow SDK. Our SDK will return the WebResourceResponse back to the WebView to insert the ad source.
mWebView.setWebViewClient(new WebViewClient() {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
if (request.getUrl() != null && request.getUrl().toString() != null &&
request.getUrl().toString().indexOf(WebAd.INTOWOW_PREFIX) != -1) {
WebResourceResponse response = mWebAd.shouldInterceptRequest(view, request);
if (response != null) {
return response;
}
}
return super.shouldInterceptRequest(view, request);
}
});
3. Destroy WebAd if you no longer need to use it
Please destroy the instance when you no longer need to use it.
if(mWebAd != null) {
mWebAd.unregisterWebView();
mWebAd.destroy();
}
Please see the web side for further integration detail.
Note:
Please make sure to new an instance before requesting the ad.
Public constructors
WebAd(Context context) Instantiates a new webAd.
Public methods
void
destroy() Release the native ad.
void
registerWebView(WebView webview) Register web view for interaction.
void
unregisterWebView() Unregister Web view.
WebResourceResponse
shouldInterceptRequest(WebView view, WebResourceRequest request)Pass the request path which related to intowow and will return the webResourceResponse back to web view.
WebAd(Context context)
Instantiates a new WebAd.
Parameters
context
Context: the context.
destroy
void destroy()
Release the WebAd.
registerWebView
void registerWebView(WebView webview)
Register web view for interaction.
Please called this function before load the page url.
unregisterWebView
void unregisterWebView(WebView webview)
Unregister web view when no long use.
shouldInterceptRequest
WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request)
Pass the request path which related to intowow and return the webResourceResponse back to web view.
Last updated