레이블이 webview인 게시물을 표시합니다. 모든 게시물 표시
레이블이 webview인 게시물을 표시합니다. 모든 게시물 표시

2015년 9월 16일 수요일

window.localStorage, Android webview localStorage 사용 설정

Webview 사용 중 HTML5 local storage 사용을 위해 찾아 봄

Web Storage로 local storage, session storage를 지원하고 있고
사용자 브라우저상에서 간단히 key/value쌍으로 저장할 수 있어 간편함.

표준 : http://www.w3.org/TR/webstorage/
MDN : https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API


localStorage와 sessionStorage의 차이점은
sessionStorage는 브라우저가 열려서 닫히기 전까지 유지된다는 점이고
localStorage는 삭제 시점이 없어 거의 영구적(local에서 삭제 되기 전까지)으로 유지된다는 점이다.

Window.sessionStorage
: https://developer.mozilla.org/ko/docs/Web/API/Window/sessionStorage


Window.localStorage
: https://developer.mozilla.org/ko/docs/Web/API/Window/localStorage
HTML5 Local Storage API 설정, 기본적으로 false로 되어 있음.
=> webview.getSettings().setDomStorageEnabled(true);

database storage API 사용 설정, 페이지 로드 전에 되어야 함.
=> settings.setDatabaseEnabled(true);

Application Cache API사용 설정, database path도 함께 설정 필요
=> settings.setAppCachePath(dir.getPath());
=> settings.setAppCacheEnabled(true);


롤리팝 부터는 WebView가 Platform 차원에서 관리 되던데
관련하여 API 사용이 변경되는 게 없는지 궁금함.
특히나 application cache 설정이 좀 바뀌지 않을까 생각되는데
자세한 내용은 못 찾겠음.


그래서 일단은 아래와 같이 사용..

WebSettings settings = webview.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
settings.setDatabaseEnabled(true);

File dir = getCacheDir();
if (!dir.exists()) {
    dir.mkdirs();
}
settings.setAppCachePath(dir.getPath());
settings.setAppCacheEnabled(true);


그 외 setAppCacheMaxSize() 호출 하던데,
API level 18에서 deprecated 되어 굳이 필요 없을 듯.

2015년 6월 24일 수요일

Android Webview, Gear 상에서의 GPS 개발 관련 정리

[Geolocation API 사용을 위한 Android Webview 설정]


Android Webview 내에서 Geolocation API를 사용하려면 아래와 같은 설정이 필요하다.

참고
http://stackoverflow.com/questions/5329662/android-webview-geolocation


1. Android app에서 location 관련 permission 명시

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />


2. Geolocation API 사용을 위한 Webview 설정

: JavaScript enable, Geolocation enable, Geolocation caching을 위한 DB path 설정
http://developer.android.com/reference/android/webkit/WebSettings.html

webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setGeolocationEnabled(true);
webView.getSettings().setGeolocationDatabasePath(Context.getFilesDir().getPath());


아래 HTML5 관련 설정들은 실제 Geolocation API에 영향을 주는지 확인은 안했지만
사용하는 webview에서 사용하고 있었던 것이라 혹시나 안된다면 아래 것도 추가를..

webView.getSettings().setDatabaseEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setAppCacheEnabled(true);


3. 위치 정보 접근 허용을 위한 알림 및 허용 처리

: 위치정보 접근 허용을 위한 WebChromeClient.onGeolocationPermissionsShowPrompt() 구현
http://developer.android.com/reference/android/webkit/WebChromeClient.html#onGeolocationPermissionsShowPrompt(java.lang.String, android.webkit.GeolocationPermissions.Callback)

아래 예제에서는 그냥 사용자에게 prompt를 보여주지 않고 자동으로 위치정보를 접근하게 한예제이니 사용자에게 알릴 필요가 있다면 여기서 알려야함.

webView.setWebChromeClient(new WebChromeClient() {
 public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
 }
});


위 방법들을 사용하면 Android webview 내에서 Geolocation API를 사용할 수 있다.


[Geolocation APIs - getCurrentPosition, watchPosition]

: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation

getCurrentPosition, watchPosition에 대한 설명이다.

둘다 위치 정보를 얻기 위해 hardware를 사용하므로 비동기적(asynchronous)으로 callback을 통해 결과를 전달하는 것은 동일하지만 getCurrentPosition은 일회적으로 현재 위치를 제공하는 것이고 watchPosition은 위치의 변화가 있을 경우 변경된 좌표를 제공한다는 것이 다른 점이다.
또한 아래 설명의 굵은 글씨들을 참고하면 watchPosition이 이전 좌표를 기반하여 별도의 기술을 사용하여 좀 더 정확한 좌표를 제공하려 하는 것 같다. 아마도 Android webview에서 database path를 설정하는 것도 이런 연유에서일 것으로 추측..
하지만 watchPosition은 위치 변화 뿐만아니라 좀 더 정확한 위치가 설정 되어도 알려줘서 모르겠지만 수신 받은 위치를 좀 걸러내야 할 필요성이 있는 것 같다. 특히 GPS + 네트워크 둘다 사용할 경우 종종 부정확한 위치가 전달 된다.

(발췌, MDN Using Geolocation )

Getting the current position

To obtain the user's current location, you can call the getCurrentPosition() method. This initiates an asynchronous request to detect the user's position, and queries the positioning hardware to get up-to-date information. When the position is determined, the defined callback function is executed. You can optionally provide a second callback function to be executed if an error occurs. A third, optional, parameter is an options object where you can set the maximum age of the position returned, the time to wait for a request, and if you want high accuracy for the position.


Watching the current position

If the position data changes (either by device movement or if more accurate geo information arrives), you can set up a callback function that is called with that updated position information. This is done using the watchPosition() function, which has the same input parameters as getCurrentPosition(). The callback function is called multiple times, allowing the browser to either update your location as you move, or provide a more accurate location as different techniques are used to geolocate you. The error callback function, which is optional just as it is for getCurrentPosition(), can be called repeatedly.


이와 비슷한 내용의 Answer와 예제 샘플은 다음과 같다.

watchPosition API 사용 샘플
watchPosition을 계속 실행하면 아무래도 GPS 관련 hardware를 계속 사용하게 되므로 일정시간 watchPosition을 사용하되 몇초 단위로 끊어서 사용하고 있음.
: http://stackoverflow.com/questions/8552186/how-to-get-html5-position-in-webview-updated-at-a-regular-interval-with-fine-ac


Platform, OS 별 Geolocation 사용 예제
: http://docs.phonegap.com/en/edge/cordova_geolocation_geolocation.md.html

HTML5 Geolocation API 표준 문서
: http://www.w3.org/TR/geolocation-API/#geolocation_interface

이것도 참고하시라...
: http://www.andygup.net/how-accurate-is-html5-geolocation-really-part-2-mobile-web/


[Gear에서의 GPS 사용]



- GPS feature를 제공하는 제품들은 Gear2 neo, GearS가 있는 것으로 알고 있지만
   Gear 2에서는 Geolocation API를 사용할 수 없다. (Tizen 2.3 기준)

 . 그래서 GPS 센서가 없는 모델들은 SAP(Samsung Accessory Protocol)을 사용해서 mobile의 GPS 좌표를 사용하더라..
 (http://www.codeproject.com/Articles/830305/Speedometer-for-Galaxy-Gear-Tizen-Based)


- GearS는 GPS 센서가 있지만 GPS 센서, 네트워크 위치를 사용해서 위치를 파악한다.
 . GPS 센서만 사용하고자 한다면 설정 > 연결 > GPS만 사용 에 체크

 . FakeGPS를 사용하여 GearS GPS app디버깅 방법
  : SIM 카드가 없는 상태에서 설정 > 연결 > GPS만 사용 체크 해제
    GearS와 연결된 mobile의 GPS 끄고 fake GPS로 GPS 좌표 설정
    다만 Gear GPS센서가 동작이 안되는 상태에서 가능하므로 실내에서 가능하다..


[T map OpenAPIs]



https://developers.skplanetx.com/apidoc/kor/tmap/

타 통신사에서는 그림의 떡같은 T map인 관계로 별로 좋아하지 않았지만
이번에 Geolocation 관련 API을 찾다 보니 감사하게도 Open API들을 제공하고 있었다.
제공되는 API들도 꽤나 다양해서 GPS app 개발 시 상당히 유용할 것으로 보인다.

REST API를 사용해서 몇개를 사용해 봤는데 아래 사항은 지켜야 정상 응답을 하더라.

- url에서 callback, gizAppId는 값이 없어도 파라미터로 존재해야 한다.

예를 들어 경로 안내 API를 사용하려면
: https://developers.skplanetx.com/apidoc/kor/t-map/course-guide/geojson/

https://apis.skplanetx.com/tmap/routes?version=1&bizAppId={bizAppId}&callback={callback}

위와 같은 URL을 사용해야 하는데 bizAppId와 callback은 optional 항목이다.
하지만 bizAppid와 callback을 생략하고 ?version=1 만 적으면 정상 응답이 오지 않더라.
?bizAppId=&callback=&version=1 이렇게 적어 호출하니 정상응답.


- content type 설정

REST API 호출(HTTP request시) content type을 "Content-Type: application/x-www-form-urlencoded"로 설정해야 해서 jquery의 $.ajax()를 사용 시 header param으로 명시해야 한다.

2015년 5월 13일 수요일

Tizen WebView 사용 방법 정리, 설정, page 관련 signal, navigation policy 관리

Tizen Native app 개발 중 WebView를 사용하다 답답해서 정리함.

Tizen에서 제공하는 webview는 ewebkit2 기반이라고 한다.
자세한 내용과 간단한 사용 방법은 아래 링크 참고

Hello ewebkit?
: http://bunhere.tistory.com/m/post/417

Tizen WebView tutorial
https://developer.tizen.org/documentation/tutorials/native-application/web

Tizen WebView API reference
https://developer.tizen.org/dev-guide/2.3.0/org.tizen.native.mobile.apireference/group__WEBVIEW.html


Tizen document를 봐도 간단히 page만 loading하는 수준으로만 설명 되어 있고
그리고 몇가지 생각 나는 것은

- Tizen 2.2 platform API 대비 API 수준이 퇴화 한 것 같다.
 : 하나의 예로 WebView -> Native Interface가 없어졌음.

- WebView 내 page의 디버깅할 방법이 없다.
 : console log를 확인할 방법이 없고 안드로이드 처럼 크롬 개발자 도구 연동도 못한다.

- Documentation이 부실하다.
 : 예로 API reference상의evas_object_smart_callback_add()를 사용해서 처리하는 signal에 대해서는  signal definition과 argument type만 나오고 어떻게 사용하는지는 알 수 없다.


암튼... 삽질 하면서 몇가지 알게 된 것과
일반적인 Tizen Webview 사용 방법을 정리함.


[User agent 설정, Javascritp enable, cookie 사용 설정]

이부분은 API reference에 나와 있어서 쉽게 사용할 수 있는 부분임.

// user agent 설정
ewk_view_user_agent_set(ewk_view, "사용하고 싶은 USER AGENT");
Ewk_Settings* settings = ewk_view_settings_get(ewk_view);
// javascritp 사용 설정
ewk_settings_javascript_enabled_set(settings, true);

// 모든 cookie 사용 설정
  if(NULL != ewk_view_context_get(ewk_view) &&
NULL != ewk_context_cookie_manager_get(ewk_view_context_get(ewk_view)))
{
ewk_cookie_manager_accept_policy_set(ewk_context_cookie_manager_get(ewk_view_context_get(ewk_view)), EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
}

근데.. webview 내에서 cookie를 설정할 때
webview 내의 web page에서 javascript로 cookie를 설정할 경우는 생성이 되지만
native에서 webview로 javascript execute로 cookie를 설정할 경우는 잘 안된다.

그리고 안드로이드는 platform 차원에서 cookie를 관리하는 cookie manager가 있지만
Tizen은 그런 것 없다. 만약 일반 브라우저에서 로그인 후 생성된 cookie를 동기화 해야할 경우가 있다면.... 방법을 모르겠다.


[JavaScript 실행]

Native에서 WebView 내 API를 호출할 수 있고 이는 Native에서 WebView로 전달할 것이 있을 때 유용함.

ewk_view_script_execute(ewk_view,"자바스크립트 코드", 
            "결과 전달 callback", "callback으로 전달할 user_data");

typedef void(*Ewk_View_Script_Execute_Cb )(Evas_Object *o, const char *result_value, void *user_data)

근데 재미 있는 것은 callback의 result_value가 항상 null로 넘어온다. 언젠가 수정 될듯.
(다른분께서 알려주신건데 result_value가 script에서 마지막의 변수나 return값을 가지는 함수의 결과값이 전달된다고 하니 참고..)


[Page 관련 signal]

page loading 관련, URL 변경 관련 처리를 할 수 있는 signal들을 아래와 같이 등록 가능 함.

evas_object_smart_callback_add(ewk_view, "url,changed", __on_url_changed, user_data);
evas_object_smart_callback_add(ewk_view, "load,started", __on_load_started, user_data);
evas_object_smart_callback_add(ewk_view, "load,finished", __on_load_finished, user_data);
evas_object_smart_callback_add(ewk_view, "load,error", __on_load_error, user_data);

아래와 같이 page 시작 시 signal을 등록하여 처리할 수 있음.
다만 WebView engine에서 loading은 이미 시작된 후 efl port에서 IPC를 전달 받아
callback이 실행되므로 시점 차이가 있을 수 있다.

void __on_load_started(void *user_data, Evas_Object *webview, void *event_info)
{
const char* url = ewk_view_url_get(webview);
DLOG("__on_load_started, URL = %s", url);

}

URL 변경 시 변경된 URL에 따라서 처리할 수 있음.
Hash값이 변경 되었을 경우에도 이 callback이 불리어 hash에 따라서
native에서 처리할 수 있다.

void __on_url_changed(void *user_data, Evas_Object *webview, void *event_info)
{
appdata_s *ad = (appdata_s *)user_data;
const char* url = ewk_view_url_get(webview);

DLOG("__on_url_changed, URL = %s", url);

// Do something for the changed URL.
}

이것을 활용하면 JavaScript -> Native 코드 호출이 가능하다.
JavsScript에서 hash 값을 변경하여 url 뒤에 필요한 명령을 붙이고
Native에서 __on_url_changed event callback 내에서 url의 hash값을 보고
native 코드를 처리하면 된다.


[WebView page navigation policy]

특정 domain내의 page만 webview를 통해서 보여주고 싶을 경우
아래와 같이 signal을 등록해서 처리해야 한다.

evas_object_smart_callback_add(ewk_view, "policy,navigation,decide", __on_policy_navigation, ad);

callback 내에서 이동하려는 url을 ewk_policy_decison_url_get()으로 확인한 뒤
허용되는 domain 내의 page이면 ewk_policy_decision_use()로 이동 허용
아니면 ewk_policy_decision_ignore()로 이동 취소를 하면 됨.


void __on_policy_navigation(void *user_data, Evas_Object *webview, void *event_info)
{
Ewk_Policy_Decision* decision = (Ewk_Policy_Decision*)event_info;

string _loading_url((char*)ewk_policy_decision_url_get(decision));
string _current_url(ewk_view_url_get(webview));

// 허용되는 SITE_DOMAIN 인지 확인
if(0  == _loading_url.compare(0, strlen(SITE_DOMAIN), SITE_DOMAIN) )
{
ewk_policy_decision_use(decision);
return;
}

// 허용되지 않는 URL
ewk_policy_decision_ignore(decision);
}


2015년 1월 18일 일요일

Debugging Android WebView, Chrome

[Chrome 개발자 도구를 사용한 원격 디버깅]
https://developer.chrome.com/devtools/docs/remote-debugging

chrome 개발자 툴을 사용하여 Android WebView를 원격에서 디버깅 가능함.

디버깅을 위해서 전제 조건은
- PC에 Chrome 32 이상 버전이 설치 되어야 함.
- Android 기기가 USB로 연결되어야 하고 인식도 되어야 함. (개발자 옵션의 디버깅 체크)
   (인식을 위해 Android Studio를 실행하는 것도 방법)
- Android Chrome 디버깅의 경우 Android 4.0 이상
- Android WebView를 디버깅 하기 위해서는 Android 4.4 이상

* 자세한 설정은 위 링크 참조

- WebView 디버깅을 위해서는 아래 코드를 앱에 포함해야 함.
WebView debugging must be enabled from within your application. To enable WebView debugging, call the static method setWebContentsDebuggingEnabled on the WebView class.
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      WebView.setWebContentsDebuggingEnabled(true);
  }
This setting applies to all of the application's WebViews.
Tip: WebView debugging is not affected by the state of the debuggable flag in the application's manifest. If you want to enable WebView debugging only when debuggable istrue, test the flag at runtime.
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    if (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE))
    { WebView.setWebContentsDebuggingEnabled(true); }
  }


[WebView의 console.log 확인]

http://developer.android.com/guide/webapps/debugging.html

Android 2.1 이상에서는 WebChromeClient의 onConsoleMessage()를 구현해서 로그를 직접 출력 하라고 되어 있음. (아래는 API level 8 이상일 경우)


WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.setWebChromeClient(new WebChromeClient() {
  public boolean onConsoleMessage(ConsoleMessage cm) {
    Log.d("MyApplication", cm.message() + " -- From line "
                         + cm.lineNumber() + " of "
                         + cm.sourceId() );
    return true;
  }
});

하지만 그냥 출력이 되는 경우도 있는 듯..

일단 내가 가진 galaxy s4에서는 Log Message에서 console 을 포함하거나
Log Tag가 chromium 이면 WebView에서 출력하는 console.log를 확인할 수 있음.

I/chromium﹕ [INFO:CONSOLE(78)] "Hello World!!!", source: http://192.168.0.1/wa/ (78)


[Debugging with Chrome DevTools]


Chrome DevTools Overview
: https://developer.chrome.com/devtools/index

* chrome://inspect 창에서 안드로이드 기기가 보이지 않는다면
Android Studio를 실행하고 아래 Android 로그창을 열어봐라.(ADB가 초기화 될것임)

* web 페이지의 cache를 삭제 하기 위해서 별도의 metatag를 사용할 필요 없이 dev tools 설정에서 General > "Disable cache (while DevTools is open)" 을 사용하되 dev tools가 실행되어 보여지는 상태여야 한다.

Remote Debugging
: https://developer.chrome.com/devtools/docs/remote-debugging


크롬 개발자 도구
: http://opentutorials.org/course/580


우리가 몰랐던 크롬 개발자 도구 by 박재성
: http://www.slideshare.net/netil/ss-28588952


[FireFox Developers Edition]
: https://www.mozilla.org/en-US/firefox/developer/

- FireFox 개발자 버전이며 개발자를 위한 다양한 툴이 제공됨
- CSS 수정이 용이(editing)하며 바로 화면에 적용되어 수정내역을 확인할 수 있다
  : 개발자 도구 > Style Editor 에서 수정 및 저장.
  : 하지만 렌더링 결과물이 Chrome, IE와 좀 차이가 나서 후 조정이 필요하다.

2014년 10월 20일 월요일

Android WebView

Android WebView 관련 궁금한 것들 찾아봄.


[General]

API Reference
: http://developer.android.com/reference/android/webkit/WebView.html

Tutorial with Android Studio
https://developer.chrome.com/multidevice/webview/gettingstarted

Building Web Apps in WebView
http://developer.android.com/guide/webapps/webview.html

Pixel-Perfect UI in the WebView
https://developer.chrome.com/multidevice/webview/pixelperfect

WebView를 이용한 App 개발 tutorial
 by 제트스윙(http://www.zetswing.com)

http://www.zetswing.com/bbs/board.php?bo_table=java_04&wr_id=2
  http://www.zetswing.com/bbs/board.php?bo_table=java_04&wr_id=3
    > Android 버전별 file chooser 동작 이슈 해결 방법 설명
  http://www.zetswing.com/bbs/board.php?bo_table=java_04&wr_id=5


[Chrome based WebView (Android 4.4.3 later)]

아래 링크에서 언급된 것 처럼 Android 4.4.3(KitKat)에서 부터 Chrome 기반 WebView가 사용되고 있다고 함.
 . Android 4.4.3에서는 Chrome 30.0.0.0 기반 WebView가 사용되고 있음.
 . Android L Developer Preview에서는 36.0.0.0 기반이 사용되고 있다고 함.
   : https://developer.chrome.com/multidevice/webview/overview
   : Android 5.0 LOLLIPOP에서는 37.0.0.0 기반이며 System WebView를 제공하여 Google Play Store를 통해 업데이트 되어 파편화 문제가 사라짐.
    > http://youtu.be/HHXwsgw7M8s?t=3m13s


WebView User Agent 
https://developer.chrome.com/multidevice/user-agent#webview_user_agent
Old WebView UA:Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; Build/KLP)AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30
New WebView UA:Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_)AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0Mobile Safari/537.36

Supporting Chrome(for Android)'s feature 
WebView v30WebView v33WebView v36
WebGLxx
WebRTCxx
WebAudioxx
Fullscreen APIxxx
Form validationx
Filesystem APIxxx
File input typexxx
<datalist>x
잘모르겠고 Android 5.0 LOLLIPOP의 WebView에서는 WebRTC가 된다는 말인가?
WebRTC의 자세한것은 => http://www.html5rocks.com/ko/tutorials/webrtc/basics/


Supporting hardware sensor APIs on new WebView
WebView v30WebView v33
Geolocation API
(requires
android.permission.ACCESS_COARSE_LOCATIONand/or
android.permission.ACCESS_FINE_LOCATIONpermissions)
Device Orientation APIxx
Media Capture and Streamsxx
Vibration API
(requires android.permission.VIBRATEpermission)
x
LOLLIPOP에서는 Vibration API가 지원된다는 얘기 이고 vibrations API는 아래 참고
=> https://developer.mozilla.org/ko/docs/Web/Guide/API/Vibration/Vibration


[Interface between JavaScript and Native]

아래 링크 참조
http://developer.android.com/guide/webapps/webview.html#UsingJavaScript

WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
1. WebView를 생성
2. WebView의 WebSettings의 setJavaScriptEnalbed(true) 설정

public class WebAppInterface {
    Context mContext;

    /** Instantiate the interface and set the context */
    WebAppInterface(Context c) {
        mContext = c;
    }

    /** Show a toast from the web page */
    @JavascriptInterface
    public void showToast(String toast) {
        Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
    }
}
WebView webView = (WebView) findViewById(R.id.webview);
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
3. JavaScript interface class 구현 및 설정

<input type="button" value="Say hello" onClick="showAndroidToast('Hello Android!')" />
<script type="text/javascript">
    function showAndroidToast(toast) {
        Android.showToast(toast);
    }
</script>
4. Javascript에서 Native 호출


addJavascriptInterface를 좀 더 들여야 보면
http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String)

- Interface class의 method들 중
 . JELLY_BEAN_MR1 이상 : public method들과 @JavascriptInterface 명시된 것들만 호출
 . JELLY_BEAN 이하 : 모든 public method들이 호출 된다.
 => WebView를 사용한 app이 의도치 않은 JELLY_BEAN 이하 버전에서 동작할 때 webview interface의 모든 methods들이 호출 될 수 있으므로 보안상 신중하게 interface를 구현할 필요가 있음.

- JavaScript는 WebView의 private, background thread와 연동되므로 thread safety를 염두 해야 한다고 한다.. 실제예는 안 찾았음.
- Android 5.0 LOLLIPOP API level의 application의 WebView에서는 injected된 Java object의 methods들이 JavaScript에서 확인 가능하다고 한다.. 안해봄..
- Interface class의 method들은 primitve를 사용하는게 기본이겠지만 어떤 사람들은 JSONObject, JSONArray도 사용 가능하다고 한다..  안되면 그냥 stringify해서 넘기면 될듯
 => http://stackoverflow.com/questions/2250917/passing-a-javascript-object-using-addjavascriptinterface-on-android
 Java object를 넘겼다는 사람도 있는데 봐도 이해가 안되고 왠지 그대로 하다가 고생할것 같다.. => http://stackoverflow.com/questions/21173888/how-to-pass-non-primitive-object-from-java-to-js-by-android-addjavascriptinterfa


[Android 버전별 WebView 이슈들]

Migrating to WebView in Android 4.4
: https://developer.android.com/guide/webapps/migrating.html

kitkat(4.4)에서 맞닥뜨린 이슈 및 해결
by marojun
https://medium.com/marojuns-android/kitkat-4-4-%EC%97%90%EC%84%9C-%EB%A7%9E%EB%8B%A5%EB%9C%A8%EB%A6%B0-%EC%9D%B4%EC%8A%88-%EB%B0%8F-%ED%95%B4%EA%B2%B0-1ecb94c24694

버전별 WebKit 버전
by Padgom
: http://padgom.tistory.com/entry/Android-%EB%B2%84%EC%A0%84%EB%B3%84-Webkit-%EB%B2%84%EC%A0%84

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



[Remote Debugging on Android with Chrome]
: https://developer.chrome.com/devtools/docs/remote-debugging


[기타]

찾다 보니 Mozilla GeckoView도 있구나..

HTML5의 충실한 지원으로, Android WebView를 대체하는 View로 충분한 Mozilla GeckoView 사용하기.. by 코딩한줄에 12시간
: http://sjava.net/?p=471


WebView attack 관련 논문
선 링크 후 분석...
http://www.cis.syr.edu/~wedu/Research/paper/webview_acsac2011.pdf