Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Android 9 cookies read issue

hi,

I just got a strange issue from Android 9. 1 times on 3, only after the installation, the cookies can't be read.

public override void OnPageFinished(Android.Webkit.WebView view, string url)
    {
        Dictionary<string, string> cookiePair = new Dictionary<string, string>();
        string cookieHeader = CookieManager.Instance.GetCookie(url);
        if (cookieHeader != null)
        {
            foreach (string cookieValue in cookieHeader.Split(';'))
            {
                string[] cookie = cookieValue.Split('=');
                cookiePair.Add(cookie[0].Trim(), cookie[1].Trim());
            }
        }

        //Sauvegarde les cookie dans la mémoire persistante
        CookieManager.Instance.Flush();

        this.webViewRenderer.Element.OnNavigated(new Pa_NavigatedEvent { cookies = cookiePair, Url = url });
    }
Tagged:
Sign In or Register to comment.