본문 바로가기

Study/Android

[android] webview bridge

TEST.java

protected class AndroidBridge {
 public AndroidBridge() {}

 public String sendIMEI() {
  TelephonyManager manager = (TelephonyManager)
  TEST.this.getSystemService(Context.TELEPHONY_SERVICE);
  String imei = manager.getDeviceId();
  mWebView.loadUrl("javascript:getIMEI("+imei+");");
 }
}

 

TEST.js  

var imei = "";
function callIMEI() {
 window.Android.sendIMEI2();
}

 

 

 

 

출처:

http://devian.tistory.com/159