Package Index - Awp API

Quick Start Guide to Using AWP(Accelerated WebView Project)

AWP is the extension of Android WebView put into a library for use on mobile. It offers an easy-to-use, high performance, standards-compliant, and secure way to use WebView. AWP has support for ALL Android version after Ice Cream Sandwich. This document gives a brief introduction to using AWP.

Basics

First you will need to put awp_sdk.aar into your project's libs directory, and add below codes to your build.gradle.

    android {

        aaptOptions {

            additionalParameters '--extra-packages', 'com.sogou.android.chromium:com.sogou.org.chromium.ui:com.sogou.com.android.webview.chromium:com.sogou.org.chromium.content:com.sogou.org.chromium.components.autofill:com.sogou.org.chromium.components.web_contents_delegate_android'
        }

        repositories {
            flatDir {
                dirs 'libs'
            }
        }
    }

    dependencies {
        compile(name: 'awp_sdk', ext: 'aar')
    }

Second you will need to call AwpEnvirnoment.init() to initialize AWP's envirnoment in Application.onCreate().

    class MyApplication extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            AwpEnvironment.init(this, true);
        }
    }

Now, you can use many fantasy features of AWP like these:

    // Enables debugging of web contents (HTML / CSS / JavaScript)
    AwpEnvironment.getInstance().setAwpDebuggingEnabled(true);
    AwpExtension extension = AwpEnvironment.getInstance().getAwpExtension(mWebView);
    if (extension != null) {
        // Enables SmartImages loading
        extension.getAwpSettings().setSmartImagesEnabled(true);
        // Enables NightMode
        extension.getAwpSettings().setNightModeEnabled(true);
    }
    // Enables AdBlock
    AwpSharedStatics statics = AwpEnvironment.getInstance().getSharedStatics();
    if (statics != null) {
        statics.setAdBlockEnabled(true);
    }

    and so on ...

AWP Demo

We provide a AWP Demo for using AWP. Please click link for more details. There are also useful examples for Developing apps with the Android WebView. If you have any problem or suggestion, please let me know.(fanjinsong@sogou-inc.com)

com.awp.webkit