AgentWeb Documentation

repository·androidx·Indexed 27 days ago

https://github.com/justson/agentweb

A lightweight and flexible Android WebView library designed to resolve common WebView issues. It provides core functionality for implementing web features in Android applications, with optional modules for file choosing and downloading.

Tokens
413
Snippets
1
Records
2
Agent score
44%

What's inside AgentWeb

  1. Add AgentWeb to your Android project via Gradle

    androidx

    To use AgentWeb, you must first add the JitPack repository to your allprojects block in your Gradle configuration. Then, add the core library and any optional modules you require using the AndroidX versions.

    allprojects {
      repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
      }
    }
    
    // Dependencies
    implementation 'io.github.justson:agentweb-core:v5.1.1-androidx' 
    implementation 'io.github.justson:agentweb-filechooser:v5.1.1-androidx' // (Optional)
    implementation 'com.github.Justson:Downloader:v5.0.4-androidx' // (Optional)
  2. Important considerations when using AgentWeb

    androidx

    Before integrating AgentWeb, note the following technical requirements and limitations:

    • Themes: AgentWeb uses AlertDialog internally, so your application must depend on an AppCompat theme.
    • Layouts: The setAgentWebParent method does not support ConstraintLayout.
    • Lifecycle: Calling mAgentWeb.getWebLifeCycle().onPause(); will pause all WebView instances within the application.
    • Payments: For Alipay support, you must manually include and depend on the Alipay SDK in your project. WeChat Pay requires no additional configuration.
    • Security: If your minSdkVersion is 16 or lower, be cautious regarding the security of communication between custom WebView instances and JavaScript.