Android CookieSyncManager

Are the cookies kept persistent when we use this? Are the cookies still available even after the phone restarts? I am referring to this link: http://developer.android.com/reference/android/webkit/CookieSyncManager.html

Say we are using DefaultHttpClient, CookieSyncManager would know to grab the cookies or are there other commands then the ones in the link that we will still need to provoke? How do we get the cookies back?

Answers


According to Cookies & Webview - CookieSyncManager in Android! it seems that CookieSyncManager works with the android's built webview:

CookieSyncManager.createInstance(webview.this);

So this is not something one would use if their app is not based on the webview.


try setting CookieSyncManager.getInstance().sync(); in the "onPageFinished" method, that worked for me like a charm, it mantaings the cookie even when restarted :)

here the code:

public void onCreate(Bundle savedInstanceState) {   
CookieSyncManager.createInstance(web.getContext());
        web = new WebView(this);  
        web.getSettings().setJavaScriptEnabled(true);
    web.loadUrl(url);
        web.setWebViewClient(new myWebClient());
...

}

public class myWebClient extends WebViewClient { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { // TODO Auto-generated method stub super.onPageStarted(view, url, favicon); }

    @Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);
        CookieSyncManager.getInstance().sync();
    }
}

Need Your Help

Prism compatibility with UWP

mvvm win-universal-app prism

I recently started learning about Prism with UWP. Is there any specific new version of Prism to work with UWP? Can anyone share any tutorial for Prism with UWP in Visual Studio 2015??

Connecting to remote SQL server using IP address

c# sql sql-server sql-server-2005

I dont have so much experience in SQL server. I'm trying to connect to an SQL Server 2005 via IP address. My connection string is: