WebView 내 Javascript 및 Local storage 활성화합니다.
private WebView hybridWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hybrid);
hybridWebView = (WebView) findViewById(R.id.hybrid_webview);
hybridWebView.getSettings().setJavaScriptEnabled(true);
hybridWebView.getSettings().setDomStorageEnabled(true);
}
2. Javascript Interface 설정
private WebView hybridWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hybrid);
hybridWebView = (WebView) findViewById(R.id.hybrid_webview);
hybridWebView.getSettings().setJavaScriptEnabled(true);
hybridWebView.getSettings().setDomStorageEnabled(true);
hybridWebView.addJavascriptInterface(new AdPopcornSSPJsBridge(this, hybridWebView), AdPopcornSSPJsBridge.INTERFACE_NAME);
}
위 2가지 연동을 hybrid webview에 설정해주면 네이티브와 통신을 위한 준비가 마무리됩니다.