appView.addJavascriptInterface() does not work on API 17

前端 未结 4 2054
我寻月下人不归
我寻月下人不归 2021-02-01 05:27

i am able to use java function from my phonegap java script function and android 2.2 but same code is not run on API 17. what should i have to do to call native java code on fr

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-01 06:29

    From the Android 4.2 documentation:

    Caution: If you've set your targetSdkVersion to 17 or higher, you must add the @JavascriptInterface annotation to any method that you want available your web page code (the method must also be public). If you do not provide the annotation, then the method will not accessible by your web page when running on Android 4.2 or higher.

    Source: Android WebView Doc (emphasis added)

提交回复
热议问题