internal static void openAppLink(String applinkHandle, String campaignHandle, String uniqueID) { if (currentRedirector != null) { currentRedirector.cancel(); currentRedirector = null; } if (applinkHandle != null && applinkHandle.Length > 0) { StringBuilder builder = new StringBuilder("http://app.lk/").Append(applinkHandle).Append("/redirect?x="); if (campaignHandle != null) { builder.Append(campaignHandle); } builder.Append("&u="); if (uniqueID != null) { builder.Append(uniqueID); } //Call url currentRedirector = new AppLinkRedirector(builder.ToString()); currentRedirector.OnRedirectDone += new EventHandler <AppLinkRedirector.AppLinkRedirectorArgs>(OnRedirectDone); currentRedirector.OnRedirectFailed += new EventHandler <AppLinkRedirector.AppLinkRedirectorArgs>(OnRedirectFailed); currentRedirector.start(); } }
internal static void openAppLink(String applinkHandle, String campaignHandle, String uniqueID) { if (currentRedirector != null) { currentRedirector.cancel(); currentRedirector = null; } if (applinkHandle != null && applinkHandle.Length > 0) { StringBuilder builder = new StringBuilder("http://app.lk/").Append(applinkHandle).Append("/redirect?x="); if (campaignHandle != null) { builder.Append(campaignHandle); } builder.Append("&u="); if (uniqueID != null) { builder.Append(uniqueID); } //Call url currentRedirector = new AppLinkRedirector(builder.ToString()); currentRedirector.OnRedirectDone += new EventHandler<AppLinkRedirector.AppLinkRedirectorArgs>(OnRedirectDone); currentRedirector.OnRedirectFailed += new EventHandler<AppLinkRedirector.AppLinkRedirectorArgs>(OnRedirectFailed); currentRedirector.start(); } }
//Callback methods internal static void OnRedirectDone(object sender, AppLinkRedirector.AppLinkRedirectorArgs e) { if (sender.Equals(currentRedirector)) { Utils.log("OnRedirectDone"); currentRedirector = null; } }
internal static void OnRedirectFailed(object sender, AppLinkRedirector.AppLinkRedirectorArgs e) { if (sender.Equals(currentRedirector)) { if (e.fallbackUrl != null) { Utils.log("OnRedirectFailed fallbackUrl: " + e.fallbackUrl); WebBrowserTask task = new WebBrowserTask(); task.Uri = new Uri(e.fallbackUrl); try { task.Show(); } catch (Exception) { //Just don't show the task } } currentRedirector = null; } }