AppKit WebView integration

AppKit WebView let you easily monetize your app showing a web page with a list of apps. The Instal SDK execute the download and all the tracking automatically, you can just populate your layout with the WebView and invoke the method to load the page.

Prerequisites

Before integrating AppKit WebView ads in your app, you’ll need to go through the steps in our Getting Started Guide to integrate the SDK into your project.

Load the html page

The Instal SDK provides a custom class, DiscoveryWebView, that handles fetching the html page and manage the clicks on the WebView. In the layout of your Activity (or Fragment) you need to include a new DiscoveryWebView:

@Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    DiscoveryWebView webView = new DiscoveryWebView(this);
    setContentView(webView);
    webView.load("1");
}

You need to invoke load method to populate the WebView. A loading indicator is used while the page is loading, in case of errors (or when a connection is not available) an error layout with a retry button is automatically shown.

Layout customization

If you want to customize loading and error layout you need to set a DiscoveryWebViewListener on the DiscoveryWebView, in the implementation you need to manage the events manually:

webView.setListener(new DiscoveryWebViewListener() {
    @Override public boolean onStartLoading() {
        //...
        return true;
    }

    @Override public void onLoaded() {
        //...
    }

    @Override public boolean onFail() {
        //...
        return true;
    }
});

The methods onStartLoading and onFail return a boolean, returning true the signal that the event has been managed (the default loading or error layout will not be shown).

A complete Activity is available in sample app.