短剧 CookieManager cookieManager = CookieManager.getInstance(); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)

{
    cookieManager.setAcceptThirdPartyCookies(mainWv, true);
    } else{
      cookieManager.setAcceptCookie(true);
    }
This commit is contained in:
18401019693 2023-12-18 15:30:29 +08:00
parent 0b3ebdfc30
commit f65c698602
2 changed files with 10 additions and 3 deletions

View File

@ -9,9 +9,9 @@ ext {
]
manifestPlaceholders = [
//
serverHost : "https://napi.yaoulive.com",
// serverHost : "https://napi.yaoulive.com",
//
// serverHost : " https://ceshi.yaoulive.com",
serverHost : " https://ceshi.yaoulive.com",
//

View File

@ -17,6 +17,7 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
@ -102,7 +103,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
Bus.getOn(this);
String url = HtmlConfig.ENCOURAGE + "?t=" + Math.random() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()
+ "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0");
// String url = "https://coolshi.feioou.com/testAndroid.html";
// String url = "https://api.coolydrama.com/?agentCode=186279";
final LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
mWebView = new WebView(mContext);
@ -119,6 +120,12 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cookieManager.setAcceptThirdPartyCookies(mWebView, true);
} else {
cookieManager.setAcceptCookie(true);
}
String appCachePath = mContext.getCacheDir().getAbsolutePath();
// mWebView.getSettings().setAppCachePath(appCachePath);
mWebView.getSettings().setAllowFileAccess(true);