public class MainActivity extends Activity { private Handler MyHandler = new Handler(); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView wv1 =( WebView)findViewById(R.id.webView1); wv1.getSettings().setLoadsImagesAutomatically(true); wv1.getSettings().setJavaScriptEnabled(true); String url = "https://abcd.com"; wv1.loadUrl(url); MyHandler .postDelayed(MyThread, 0); CookieManager.getInstance().setAcceptThirdPartyCookies(wv1, true); } private Runnable MyThread = new Runnable() { public void run() { Update_Value(); MyHandler.postDelayed(this, 10000); } }; private void Update_Value() { String _Value= Get_Value(); CookieSyncManager.createInstance(this); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); cookieManager.setCookie("MyValue", _Value); CookieSyncManager.getInstance().sync(); //?cookieManager.flush(); } }
protected void btn_ShowValue_Click(object sender, EventArgs e) { object _Value = Response.Cookies["MyValue"].Value; if (_Value != null) txt_Result.Text = "Result : " + _Value.ToString(); else txt_Result.Text = "Value not found"; }
Request.Cookies
Response.Cookies
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)