Skip to content
/ Faraday Public

A set of perfect H5 hybrid jsbridge solution of Android

Notifications You must be signed in to change notification settings

kymjs/Faraday

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OSL

Faraday

中文文档

A set of perfect H5 hybrid jsbridge solution of Android, which is simple and convenient for development and debugging

  • Compatible with Android 12

  • Support androidx package

  • No privacy related issues

Getting Started

latest version numbers:

// root build.gradle
allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

// module build.gradle
dependencies {
    implementation 'com.github.kymjs:faraday:2.0.0'
}

register JSBridge

FaradayBridge.getInstance().register(new DemoBridge());

customs WebView

public class InjectedChromeClient extends WebChromeClient {
    @Override
    public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
      //  只需要在 onJsPrompt 方法中通知Faraday即可
      result.confirm(FaradayBridge.getInstance().call(view, message));
        return true;
    }
}

native call js

使用简单,且方便自定义封装,对 H5 侧开发更直观

webview.loadUrl("javascript://window.hello()");

Requirements

Faraday can be included in any Android application.

Faraday supports Android 4.0, API14 (HONEYCOMB_MR1) and later.

License

Licensed under the Apache License Version 2.0. The "License"