英文:
how to save google login session android webView?
问题
webView = findViewById(R.id.webView);
String url = "https://www.youtube.com/watch?v=" + vidInfo[vidNum][2];
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setAppCachePath(getCacheDir().getPath());
webSettings.setAppCacheEnabled(true);
webSettings.setMediaPlaybackRequiresUserGesture(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl(url);
英文:
i have an android app with a webView to open some youtube links but i have a problem that every time the app close and reopen i need to login again i read some questions here but didn't got an answer this is my code.
webView = findViewById(R.id.webView);
String url = "https://www.youtube.com/watch?v="+vidInfo[vidNum][2];
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setAppCachePath(getCacheDir().getPath());
webSettings.setAppCacheEnabled(true);
webSettings.setMediaPlaybackRequiresUserGesture(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl(url);
答案1
得分: 1
你的会话数据被保存在Cookies中。因此,在不同会话之间需要使它们持久化。
英文:
your session data is saved in cookies. you therefore need to make them persistent between sessions
checkout this answer
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论