Using Weinre to Debug in Android WebView -
i'm trying debug webview in android application.i did research , found weinre quite useful.what using weinre of phonegap phonegap debugging tool.
make me confused runs fine when use debug in native browser,not when open application.when open application not show webview me inspect.
anyone knows how make work webview? or have install weinre locally make works?
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button button = (button)this.findviewbyid(r.id.button1); this.webview = (webview)this.findviewbyid(r.id.webview1); webview.setwebchromeclient(new webchromeclient()); final string htmlpre = "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"> <script src='http://172.16.0.135:8080/target/target-script-min.js#anonymous'></script> <script>alert('hello')</script></head><body style='margin:0; pading:0; background-color: black;'>"; final string htmlcode = " <embed style='width:100%; height:100%' src='http://www.platipus.nl/flvplayer/download/1.0/flvplayer.swf?fullscreen=true&video=http://www.platipus.nl/flvplayer/download/pl-600.flv&autoplay=true' " + " autoplay='true' " + " quality='high' bgcolor='#000000' " + " name='videoplayer' align='middle'" + // width='640' height='480' " allowscriptaccess='*' allowfullscreen='true'" + " type='application/x-shockwave-flash' " + " pluginspage='http://www.macromedia.com/go/getflashplayer' />" + ""; final string htmlpost = "</body></html>"; this.webview.getsettings().setjavascriptenabled(true); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub webview.loaddatawithbaseurl("null", htmlpre+htmlcode+htmlpost, "text/html", "utf-8", null); } }); i'm trying new , not work anymore, suggestion? :)
i installed weinre on dev laptop (debian) , worked charm browser , android webview.
it's simple installing weinre node.js:
sudo npm -g install weinre
documentation in documentation
finally tip: when starting server remember change
--boundhost [hostname | ip address | -all-]
if server not @ localhost.
Comments
Post a Comment