安卓一個 WebView 組件,同一個網址兩者的 Cookie 隔離
需求
一個 WebView 可以同時登錄多個帳號
作用
在 Android_GetCookies 項目用到了,可以方便管理同一個網站的多個帳號
實現
隔離函數
WebView.setDataDirectorySuffix("test");重啟程序
public void restartApp() {
final var intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
//殺掉以前進程
android.os.Process.killProcess(android.os.Process.myPid());
}版權屬於:zgcwkj
本文鏈接:https://www.zgcwkj.com/archives/245.html
轉載聲明:請注明本文章的標題及內容的出處和聲明,謝謝
評論已關閉