Exemplo n.º 1
0
        public void TestAppendUserSyncQueryParameter()
        {
            string url = "http://www.example.com";
            string urlWithQueryParameter = UserSync.AppendUserSyncQueryParameter(url);
            int    separatorIndex        = urlWithQueryParameter.IndexOf("?");
            string queryParameter        = urlWithQueryParameter.Substring(separatorIndex + 1);

            string[] parameters = queryParameter.Split('&');
            string[] keyValue   = parameters[0].Split('=');
            Assert.AreEqual("_k_ntvsync_b", keyValue[0]);
        }
Exemplo n.º 2
0
        private void UserSyncTest()
        {
            var uri = Android.Net.Uri.Parse("https://karte.io");
            var appendingQueryParameterUrl1 = UserSync.AppendUserSyncQueryParameter(uri);

            System.Diagnostics.Debug.WriteLine("AppendingQueryParameterWithURL: " + appendingQueryParameterUrl1);

            var appendingQueryParameterUrl2 = UserSync.AppendUserSyncQueryParameter(uri.ToString());

            System.Diagnostics.Debug.WriteLine("AppendingQueryParameterWithURLString: " + appendingQueryParameterUrl2);

            var webView = new WebView(this);

            webView.Settings.JavaScriptEnabled = true;
            webView.SetWebViewClient(new MyWebViewClient(view =>
            {
                UserSync.SetUserSyncScript(view);
                webView.EvaluateJavascript("(function() { return window.__karte_ntvsync; })();", new ValueCallback((value) =>
                {
                    System.Diagnostics.Debug.WriteLine("WebView UserScripts: " + value);
                }));
            }));
            webView.LoadUrl("https://karte.io");
        }