// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); LoadApplication(new App()); KRTApp.SetupWithAppKey("APP_KEY"); KRTTracker.Track("test"); return(base.FinishedLaunching(app, options)); }
public void OpenUrlContexts(UIScene scene, NSSet <UIOpenUrlContext> urlContexts) { if (urlContexts?.Count > 0) { var context = urlContexts.ToArray <UIOpenUrlContext>().First(); if (context != null) { KRTApp.Application(UIApplication.SharedApplication, context.Url); } } }
public void WillConnect(UIScene scene, UISceneSession session, UISceneConnectionOptions connectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate `GetConfiguration` instead). if (connectionOptions.UrlContexts?.Count > 0) { var context = connectionOptions.UrlContexts.ToArray <UIOpenUrlContext>().First(); if (context != null) { KRTApp.Application(UIApplication.SharedApplication, context.Url); } } }
public override void ViewDidLoad() { base.ViewDidLoad(); //For iam delegate testing iamDelegate = new SampleInAppMessagingDelegate(); KRTInAppMessaging.Shared.Delegate = iamDelegate; //For idfa testing idfaDelegate = new SampleIDFADelegate(); var configuration = new KRTConfiguration(); configuration.IdfaDelegate = this.idfaDelegate; configuration.IsDryRun = false; KRTApp.SetLogLevel(KRTLogLevel.Verbose); KRTApp.SetupWithAppKey("APP_KEY", configuration); KRTInAppMessaging.Configure(); KRTNotification.Configure(); KRTVariables.Configure(); KRTTracker.View("chat", "chat"); System.Diagnostics.Debug.WriteLine("AdvertisingIdentifierString: " + idfaDelegate.AdvertisingIdentifierString); System.Diagnostics.Debug.WriteLine("VisitorId: " + KRTApp.VisitorId); System.Diagnostics.Debug.WriteLine("IsOptOut: " + KRTApp.IsOptOut); string[] btnTitles = new string[] { "Identify", "View", "Track", "ViewForScene", "Push", "UserSync", "OptOut", "OptIn", "RenewVisitorId", "IsPresenting", "Dismiss", "Suppress", "Unsuppress", "Fetch Variables" }; AddButtons(btnTitles); }
public void Setup(string appkey) { KRTApp.SetupWithAppKey(appkey, KRTConfiguration.DefaultConfiguration); }
public void AddButtons(string[] titles) { foreach (var item in titles.Select((v, i) => new { v, i })) { var button = new UIButton(UIButtonType.RoundedRect) { Bounds = new RectangleF(0, 0, 200, 30), Center = new PointF((float)View.Bounds.Width / 2, 80 + 40 * item.i), }; button.SetTitle(item.v, UIControlState.Normal); button.TouchUpInside += (sender, args) => { switch (item.v) { case "Identify": KRTTracker.Identify(new NSDictionary("name", "sample-name")); break; case "View": KRTTracker.View("banner"); break; case "Track": KRTTracker.Track("favorite", new NSDictionary( "id", "P00003", "name", "ミネラルウォーター(500ml)", "price", "100" )); var task = KRTTracker.Track("buy", new NSDictionary("name", "sample-name")); task.Completion = (isSuccess) => { System.Diagnostics.Debug.WriteLine("TrackingTask isSuccess: " + isSuccess); }; break; case "ViewForScene": TrackFromTrackerInstance(); break; case "Push": KRTTracker.View("push_text", "push_text", new NSDictionary("name", "sample-name")); break; case "UserSync": var nSUrl = new NSUrl(new NSString("https://karte.io")); var appendingQueryParameterUrl1 = KRTUserSync.AppendingQueryParameterWithURL(nSUrl); System.Diagnostics.Debug.WriteLine("AppendingQueryParameterWithURL: " + appendingQueryParameterUrl1); var appendingQueryParameterUrl2 = KRTUserSync.AppendingQueryParameterWithURLString(nSUrl.AbsoluteString); System.Diagnostics.Debug.WriteLine("AppendingQueryParameterWithURLString: " + appendingQueryParameterUrl2); var webView = new WKWebView(CoreGraphics.CGRect.Empty, new WKWebViewConfiguration()); KRTUserSync.SetUserSyncScriptWithWebView(webView); var url = new NSUrl("https://karte.io"); if (url != null) { webView.LoadRequest(new NSUrlRequest(url)); } System.Diagnostics.Debug.WriteLine("WebView UserScripts: " + webView.Configuration.UserContentController.UserScripts.First().Source); break; case "OptOut": KRTApp.OptOut(); break; case "OptIn": KRTApp.OptIn(); break; case "RenewVisitorId": KRTApp.RenewVisitorId(); break; case "IsPresenting": System.Diagnostics.Debug.WriteLine("IsPresenting: " + KRTInAppMessaging.Shared.IsPresenting); break; case "Dismiss": KRTInAppMessaging.Shared.Dismiss(); break; case "Suppress": KRTInAppMessaging.Shared.Suppress(); break; case "Unsuppress": KRTInAppMessaging.Shared.Unsuppress(); break; case "Fetch Variables": FetchVariable(); break; } }; View.AddSubview(button); } }
public bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { return(KRTApp.Application(app, url)); }