In my application I am using webview and in that I am opening the url "drive.google.com/keep" And while creating notes in the webpage, there is an option of choosing the image from gallery, And while I click on that to choose the image nothing happens and App stays there without doing anything. While in Web browser it is opening the gallery correctly. I think I am missing to enable something which I don't know. Here is my code :
Activity Code:
public void webviewSetup() {
setContentView(R.layout.activity_main);
CookieSyncManager.createInstance(this);
keepWebView = (WebView) findViewById(R.id.activity_main_webview);
keepWebView.addJavascriptInterface(keepWebView, url);
WebSettings webSet = keepWebView.getSettings();
webSet.setJavaScriptEnabled(true);
final ProgressBar pb = getProgressBar();
if (pb != null)
pb.setVisibility(View.VISIBLE);
// Enabling local database
webSet.setDatabaseEnabled(true);
// Enable manifest cache.
String cachePath = this.getApplicationContext()
.getDir("cache", Context.MODE_PRIVATE).getPath();
webSet.setAppCachePath(cachePath);
webSet.setAllowFileAccess(true);
webSet.setAppCacheEnabled(true);
webSet.setDomStorageEnabled(true);
// webSet.setAppCacheMaxSize(1024 * 1024 * 8);
webSet.setCacheMode(WebSettings.LOAD_DEFAULT);
// loads the url
keepWebView.loadUrl(url);
keepWebView.setWebViewClient(new KeepWebViewClient(this, keepWebView,
pb));
}
And my KeepWebViewClient.class
public class KeepWebViewClient extends WebViewClient {
Activity activity;
WebView wv;
View pd;
public KeepWebViewClient(Activity activity, WebView wv, View pd) {
this.activity = activity;
this.wv = wv;
this.pd = pd;
}
@Override
public boolean shouldOverrideUrlLoading(WebView mWebView, String url) {
mWebView.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
if (pd != null)
pd.setVisibility(View.GONE);
CookieSyncManager.getInstance().sync();
super.onPageFinished(view, url);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
Log.d("GoogleApps", "loading " + url);
if (pd != null)
pd.setVisibility(View.VISIBLE);
super.onPageStarted(view, url, favicon);
}
}
Any help would be really appreciated. Thanks