public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { //streethawk register install sample. SHApp.instance().appKey = "XSample_Unified"; SHApp.instance().enableLogs = true; SHApp.instance().iTunesId = "507040546"; SHApp.instance().streethawkinit(); //streethawk set advertisement id. SHApp.instance().advertisementId = "BEE83220-9385-4B36-81E1-BF4305834093"; if (SHApp.instance().advertisementId != "BEE83220-9385-4B36-81E1-BF4305834093") { Console.WriteLine("Test fail: advertisementId get set mismatch."); } //streethawk handle open url sample. SHApp.instance().shDeeplinking = delegate(NSUrl openUrl) { UIAlertView alert = new UIAlertView("Open url handler: ", openUrl.AbsoluteString, null, "OK", null); alert.Show(); }; //streethawk callback when install register successfully. SHApp.instance().registerEventCallBack = delegate(string installId) { InvokeOnMainThread(() => { UIAlertView alert = new UIAlertView("Install register successfully: ", installId, null, "OK", null); alert.Show(); }); }; return(true); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { //optional to delay ask for permission SHPush.instance().isDefaultNotificationEnabled = false; //streethawk register install sample. SHApp.instance().appKey = "XSample_Unified"; SHApp.instance().enableLogs = true; SHApp.instance().iTunesId = "507040546"; SHApp.instance().streethawkinit(); //streethawk set advertisement id. SHApp.instance().advertisementId = "BEE83220-9385-4B36-81E1-BF4305834093"; if (SHApp.instance().advertisementId != "BEE83220-9385-4B36-81E1-BF4305834093") { Console.WriteLine("Test fail: advertisementId get set mismatch."); } //streethawk handle open url sample. SHApp.instance().shDeeplinking = delegate(NSUrl openUrl) { UIAlertView alert = new UIAlertView("Open url handler: ", openUrl.AbsoluteString, null, "OK", null); alert.Show(); }; //streethawk callback when install register successfully. SHApp.instance().registerEventCallBack = delegate(string installId) { InvokeOnMainThread(() => { UIAlertView alert = new UIAlertView("Install register successfully: ", installId, null, "OK", null); alert.Show(); }); }; //streethawk handle customized notification. SHPush.instance().shSetCustomiseHandler(new MyHandler()); //streethawk handle none StreetHawk push payload SHPush.instance().registerNonSHPushPayloadObserver = delegate(NSDictionary payload) { InvokeOnMainThread(() => { UIAlertView alert = new UIAlertView("None StreetHawk payload: ", payload.ToString(), null, "OK", null); alert.Show(); }); }; //streethawk set interactive pair buttons. InteractivePush pair1 = new InteractivePush("FacebookTwitter", "Facebook", "Twitter"); InteractivePush pair2 = new InteractivePush("EmailPhone", "Email", "Phone"); SHPush.instance().setInteractivePushBtnPairs(new InteractivePush [2] { pair1, pair2 }); return(true); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.buttonTag.TouchUpInside += delegate(object sender, EventArgs e) { bool tagSuccess = SHApp.instance().tagCuid("*****@*****.**"); if (!tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().tagCuid (\"[email protected]\")"); } tagSuccess = SHApp.instance().tagUserLanguage("user language"); if (!tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().tagUserLanguage (\"user language\")"); } tagSuccess = SHApp.instance().tagString("string_key", "abcdefg"); if (!tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().tagString (\"string_key\", \"abcdefg\")"); } tagSuccess = SHApp.instance().tagNumeric("numeric_key", 100); if (!tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().tagNumeric (\"numeric_key\", 100)"); } tagSuccess = SHApp.instance().tagDatetime("datetime_key", NSDate.FromTimeIntervalSinceNow(0)); if (!tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().tagDatetime (\"datetime_key\", DateTime.Now)"); } tagSuccess = SHApp.instance().incrementTag("numeric_key"); if (!tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().incrementTag (\"numeric_key\")"); } tagSuccess = SHApp.instance().incrementTag("numeric_key", 88); if (!tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().incrementTag (\"numeric_key\", 88)"); } tagSuccess = SHApp.instance().removeTag("string_key"); if (!tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().removeTag (\"string_key\")"); } tagSuccess = SHApp.instance().tagString("sh_phone", "+123456"); if (!tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().tagString (\"sh_phone\", \"+123456\")"); } tagSuccess = SHApp.instance().tagString("sh_phone", "abcdefg"); if (tagSuccess) { Console.WriteLine("Test fail: SHApp.app ().tagString (\"sh_phone\", \"abcdefg\")"); } }; this.buttonFeedback.TouchUpInside += delegate { SHApp.instance().shSendSimpleFeedback("directly send feedback title", @"send feedback message"); }; this.buttonVersion.TouchUpInside += delegate { UIAlertView alert = new UIAlertView("StreetHawk SDK version:", SHApp.instance().getSHLibraryVersion, null, "OK", null); alert.Show(); }; this.buttonInstallId.TouchUpInside += delegate(object sender, EventArgs e) { UIAlertView alert = new UIAlertView("Current install id:", SHApp.instance().getInstallId, null, "OK", null); alert.Show(); }; this.buttonFormattedDateTime.TouchUpInside += delegate(object sender, EventArgs e) { string currentTime = SHApp.instance().getCurrentFormattedDateTime(); UIAlertView alertCurrent = new UIAlertView("Current formatted datetime:", currentTime, null, "OK", null); alertCurrent.Show(); string certainTime = SHApp.instance().getFormattedDateTime(60 * 60); UIAlertView alertCertain = new UIAlertView("1970 formatted datetime:", certainTime, null, "OK", null); alertCertain.Show(); }; }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); //trace view enter/exit SHApp.instance().notifyViewExit(this.GetType().Name); }