Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSBridge demo #52

Closed
LuMuddy opened this issue Dec 26, 2022 · 4 comments
Closed

JSBridge demo #52

LuMuddy opened this issue Dec 26, 2022 · 4 comments

Comments

@LuMuddy
Copy link

LuMuddy commented Dec 26, 2022

JSBridge 似乎无法使用

网页为
<html><head><title>Android与JS交互实例</title><script type="text/javascript">function aa() {window.WebViewJavascriptBridge.callHandler("testSend", function (responseData) {console.log(responseData)});}</script></head><body><button onClick="aa()">点击调用java代码</button></body></html>

JAVA使用WVJBWebViewActivity页面
注册
webView.registerHandler("testSend", (data, callback) -> Log.e("----","----1----"));
没有收到任何回调

@youlookwhat
Copy link
Owner

是有点问题,我放一个demo上来

@LuMuddy
Copy link
Author

LuMuddy commented Dec 27, 2022

好的,感谢

@youlookwhat
Copy link
Owner

可以了哈,之前是我的问题,我少传了一个js文件。

放了一个demo,但是没用放 java调用js的示例,我不知道h5里面要怎么写。
加了ja调用java方法的使用示例(和你写的基本是一样的)。

具体见:fa75890

@LuMuddy
Copy link
Author

LuMuddy commented Dec 27, 2022

已经可以,感谢

@LuMuddy LuMuddy closed this as completed Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants