当前位置: 首页>>代码示例>>Java>>正文


Java CookieManager.getInstance方法代码示例

本文整理汇总了Java中android.webkit.CookieManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java CookieManager.getInstance方法的具体用法?Java CookieManager.getInstance怎么用?Java CookieManager.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.CookieManager的用法示例。


在下文中一共展示了CookieManager.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reset

import android.webkit.CookieManager; //导入方法依赖的package包/类
public void reset() {
	Editor editor = mSharedPref.edit();
	
	editor.putString(ACCESS_TOKEN, 	"");
	editor.putString(USERID, 		"");
	editor.putString(USERNAME, 		"");
	editor.putString(FULLNAME, 		"");
	editor.putString(PROFILPIC, 	"");
	editor.putInt(FOLLOW,0);
	editor.putInt(FOLLOWED,0);
	
	editor.commit();
	
	CookieSyncManager.createInstance(mContext);
	
	CookieManager cookieManager = CookieManager.getInstance();
	cookieManager.removeAllCookie();
}
 
开发者ID:inceleb,项目名称:InstagramManager-Android,代码行数:19,代码来源:InstagramSession.java

示例2: setCookie

import android.webkit.CookieManager; //导入方法依赖的package包/类
private void setCookie(Context context, String domain, String sessionCookie) {
    CookieSyncManager.createInstance(context);
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.setAcceptCookie(true);
    if (sessionCookie != null) {
        // delete old cookies
        cookieManager.removeSessionCookie();
    }
    try {
        Thread.sleep(200);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    cookieManager.setCookie(domain, sessionCookie);

    CookieSyncManager.createInstance(context);
    CookieSyncManager.getInstance().sync();
}
 
开发者ID:dueros,项目名称:dcs-sdk-java,代码行数:19,代码来源:BaseWebView.java

示例3: sendResponseMessage

import android.webkit.CookieManager; //导入方法依赖的package包/类
protected void sendResponseMessage(HttpResponse response) {
    super.sendResponseMessage(response);
    Header[] headers = response.getHeaders("Set-Cookie");
    if (headers != null && headers.length > 0) {
        CookieSyncManager.createInstance(LemallPlatform.getInstance().getContext()).sync();
        CookieManager instance = CookieManager.getInstance();
        instance.setAcceptCookie(true);
        instance.removeSessionCookie();
        String mm = "";
        for (Header header : headers) {
            String[] split = header.toString().split("Set-Cookie:");
            EALogger.i("游客登录", "split[1]===>" + split[1]);
            instance.setCookie(Constants.GUESTLOGIN, split[1]);
            int index = split[1].indexOf(";");
            if (TextUtils.isEmpty(mm)) {
                mm = split[1].substring(index + 1);
                EALogger.i("正式登录", "mm===>" + mm);
            }
        }
        EALogger.i("游客登录", "split[11]===>COOKIE_DEVICE_ID=" + LemallPlatform.getInstance().uuid + ";" + mm);
        instance.setCookie(Constants.GUESTLOGIN, "COOKIE_DEVICE_ID=" + LemallPlatform.getInstance().uuid + ";" + mm);
        instance.setCookie(Constants.THIRDLOGIN, "COOKIE_APP_ID=" + LemallPlatform.getInstance().getmAppInfo().getId() + ";" + mm);
        CookieSyncManager.getInstance().sync();
        this.val$iLetvBrideg.reLoadWebUrl();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:27,代码来源:HttpTask.java

示例4: onCreate

import android.webkit.CookieManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //清除cookie
    CookieSyncManager.createInstance(WebViewActivity.this);
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.removeAllCookie();

    setContentView(R.layout.activity_webview);

    mWebView = (WebView) findViewById(R.id.login_webview);

    mIntent = getIntent();
    mUrl = mIntent.getStringExtra("extr_url");

    mProgress = (ProgressBar) findViewById(R.id.login_webview_progress);

    init();
}
 
开发者ID:pre-dem,项目名称:pre-dem-android,代码行数:20,代码来源:WebViewActivity.java

示例5: loadUrl

import android.webkit.CookieManager; //导入方法依赖的package包/类
public void loadUrl(final String url)
{
    if (mOverrideTitle)
    {
        mContext.setTitle(url);
    }
    CookieManager cookieManager = CookieManager.getInstance();
    Log.e("AUTHTOKEN", cookieManager.getCookie("https://stackexchange.com"));

    Map<String, String> abc = new HashMap<>();
    abc.put("Set-Cookie", cookieManager.getCookie("https://stackexchange.com"));

    mWebView.loadUrl(url, abc);

    cookieManager.setAcceptCookie(true);
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:17,代码来源:CustomWebView.java

示例6: removeExpiredCookies

import android.webkit.CookieManager; //导入方法依赖的package包/类
/**
 * 清除过期的cookie
 */
public static void removeExpiredCookies() {
    CookieManager mCookieManager = null;
    if ((mCookieManager = CookieManager.getInstance()) != null) { //同步清除
        mCookieManager.removeExpiredCookie();
        toSyncCookies();
    }
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:11,代码来源:CookiesHandler.java

示例7: clearCookie

import android.webkit.CookieManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void clearCookie() {
    CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(getContext());
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.setAcceptCookie(true);
    cookieManager.removeSessionCookie();
    cookieManager.removeAllCookie();
    cookieSyncManager.sync();
}
 
开发者ID:TakWolf,项目名称:CNode-OAuth-Login-Android,代码行数:10,代码来源:CNodeOAuthLoginView.java

示例8: updateCookiePreference

import android.webkit.CookieManager; //导入方法依赖的package包/类
@Override
public void updateCookiePreference() {
	mCookieManager = CookieManager.getInstance();
	if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
		CookieSyncManager.createInstance(this);
	}

	mCookieManager.setAcceptCookie(PreferenceManager.getInstance().getCookiesEnabled());
	super.updateCookiePreference();

}
 
开发者ID:Louis19910615,项目名称:youkes_browser,代码行数:12,代码来源:BrowserMainActivity.java

示例9: saveUserSessionId

import android.webkit.CookieManager; //导入方法依赖的package包/类
public void saveUserSessionId(String userSessionId){
    // save to cookie manager
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.setCookie(CMBCHINA_BASIC_URL, "userSessionId=" +userSessionId);
    CookieSyncManager.getInstance().sync();
    // save to sharedpreference
    SharedPreferenceHelper.getInstance(getApplicationContext()).saveString(CMBCHINA_SHARED_PERFERENCE_KEY_USER_SESSION_ID,userSessionId);
}
 
开发者ID:MarcusMa,项目名称:MyCreditCardDemo,代码行数:9,代码来源:CmbChinaLoginActivity.java

示例10: get_location

import android.webkit.CookieManager; //导入方法依赖的package包/类
public void get_location(){
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
      if(ASWP_LOCATION) {
	//Checking for location permissions
	if (Build.VERSION.SDK_INT >= 23 && !check_permission(1)) {
		ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, loc_perm);
		show_notification(2, 2);

          } else {
              GPSTrack gps;
              gps = new GPSTrack(MainActivity.this);
              double latitude = gps.getLatitude();
              double longitude = gps.getLongitude();
              if (gps.canGetLocation()) {
                  if (latitude != 0 || longitude != 0) {
                      cookieManager.setCookie(ASWV_URL, "lat=" + latitude);
                      cookieManager.setCookie(ASWV_URL, "long=" + longitude);
                      //Log.w("New Updated Location:", latitude + "," + longitude);  //enable to test dummy latitude and longitude
                  } else {
                      Log.w("New Updated Location:", "NULL");
                  }
              } else {
                  show_notification(1, 1);
                  Log.w("New Updated Location:", "FAIL");
              }
          }
      }
  }
 
开发者ID:mgks,项目名称:Android-SmartWebView,代码行数:30,代码来源:MainActivity.java

示例11: SystemCookieManager

import android.webkit.CookieManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public SystemCookieManager(WebView webview) {
    webView = webview;
    cookieManager = CookieManager.getInstance();

    //REALLY? Nobody has seen this UNTIL NOW?
    cookieManager.setAcceptFileSchemeCookies(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        cookieManager.setAcceptThirdPartyCookies(webView, true);
    }
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:13,代码来源:SystemCookieManager.java

示例12: DisplayTemperatureDialog

import android.webkit.CookieManager; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
public void DisplayTemperatureDialog(@NonNull String url) {
    final Dialog dialog = createDialog();
    dialog.setContentView(R.layout.dialog_webview);

    TextView titleView = dialog.findViewById(R.id.dialog_title_text_view);
    titleView.setText("Temperature Graph");

    com.rey.material.widget.Button closeButton = dialog.findViewById(R.id.dialog_button_close);
    closeButton.setOnClickListener(v -> dialog.dismiss());

    if (!url.startsWith("http://") && !url.startsWith("https://")) {
        url = "http://" + url;
    }

    WebView webview = dialog.findViewById(R.id.dialog_webview);

    webview.getSettings().setUseWideViewPort(true);
    webview.getSettings().setBuiltInZoomControls(true);
    webview.getSettings().setSupportZoom(true);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setLoadWithOverviewMode(true);
    webview.setWebViewClient(new WebViewClient());
    webview.setInitialScale(100);

    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.setAcceptCookie(false);

    webview.loadUrl(url);

    displayDialog(dialog);
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:33,代码来源:DialogController.java

示例13: syncCookie

import android.webkit.CookieManager; //导入方法依赖的package包/类
public static void syncCookie(String url, String cookies) {

        CookieManager mCookieManager = CookieManager.getInstance();
        if (mCookieManager != null) {
            mCookieManager.setCookie(url, cookies);
            toSyncCookies();
        }
    }
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:9,代码来源:AgentWebConfig.java

示例14: onReceive

import android.webkit.CookieManager; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@Override
public void onReceive(Context context, Intent intent) {
    _logger.Debug("_screenEnableReceiver onReceive");

    _screenEnabled = true;

    _centerTextView = ((Activity) _context).findViewById(R.id.centerTextView);

    _centerWebView = ((Activity) _context).findViewById(R.id.centerWebView);
    _centerWebView.getSettings().setBuiltInZoomControls(true);
    _centerWebView.getSettings().setSupportZoom(true);
    _centerWebView.getSettings().setJavaScriptEnabled(true);
    _centerWebView.getSettings().setLoadWithOverviewMode(true);
    _centerWebView.setWebViewClient(new WebViewClient());
    _centerWebView.setWebChromeClient(new WebChromeClient());
    _centerWebView.setInitialScale(100);
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.setAcceptCookie(false);
    _centerWebView.setWebViewClient(new WebViewClient() {
        public void onPageFinished(WebView view, String url) {
            _progressDialog.dismiss();
            _loadingUrl = false;
        }
    });

    _youTubePlayerView = ((Activity) _context).findViewById(R.id.centerYoutubePlayer);
    if (Keys.YOUTUBE_API_KEY.length() != 0) {
        _youTubePlayerView.initialize(Keys.YOUTUBE_API_KEY, CenterViewController.this);
    } else {
        _logger.Warn("Please enter your youtube api key!");
        Toasty.error(_context, "Please enter your youtube api key!", Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:35,代码来源:CenterViewController.java

示例15: clearCookie

import android.webkit.CookieManager; //导入方法依赖的package包/类
public void clearCookie() {

		CookieSyncManager.createInstance(this);
		CookieManager cookieManager = CookieManager.getInstance();

		cookieManager.removeAllCookie();
		CookieSyncManager.getInstance().sync();
	}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:9,代码来源:BaseActivity.java


注:本文中的android.webkit.CookieManager.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。