partial void LoginButton_TouchUpInside(UIButton sender) { //Registration code here. Build your user details. ALUser user = new ALUser(); user.ApplicationId = ALChatManager.application_id; user.UserId = userIdTextField.Text; user.Password = passwordTextField.Text; ALUserDefaultsHandler.SetPassword(user.Password); ALUserDefaultsHandler.SetUserAuthenticationTypeId((short)AuthenticationType.Applozic); //Applozic registartion code. ALRegisterUserClientService userClientService = new ALRegisterUserClientService(); userClientService.InitWithCompletion(user, (ALRegistrationResponse response, NSError error) => { if (error == null && response.DeviceKey != null) { //Check for APNS deviceToken. If not done already, ask for registartion token. if (String.IsNullOrEmpty(ALUserDefaultsHandler.ApnDeviceToken)) { ALChatManager.registerNotification(); } UIStoryboard Storyboard = UIStoryboard.FromName("Main", null); MainViewController MainViewController = Storyboard.InstantiateViewController("MainViewController") as MainViewController; this.PresentViewController(MainViewController, true, () => { }); } else { String description = error != null ? error.LocalizedDescription : response.Message; new UIAlertView("Opps!!!", description, null, "OK", null).Show(); } }); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. // If not required for your application you can safely delete this method if (ALUserDefaultsHandler.IsLoggedIn) { ALPushNotificationService.UserSync(); // Get login screen from storyboard and present it UIStoryboard Storyboard = UIStoryboard.FromName("Main", null); MainViewController MainViewController = Storyboard.InstantiateViewController("MainViewController") as MainViewController; this.Window.MakeKeyAndVisible(); this.Window.RootViewController.PresentViewController(MainViewController, true, () => { }); } ALAppLocalNotifications localNotification = ALAppLocalNotifications.AppLocalNotificationHandler; localNotification.DataConnectionNotificationHandler(); if (launchOptions != null) { NSDictionary dictionary = (Foundation.NSDictionary)launchOptions.ObjectForKey(UIApplication.LaunchOptionsRemoteNotificationKey); if (dictionary != null) { Console.WriteLine(@"Launched from push notification: {0} ", dictionary); ALPushNotificationService pushNotificationService = new ALPushNotificationService(); Boolean applozicProcessed = pushNotificationService.ProcessPushNotification(dictionary, 0); if (!applozicProcessed) { //Note: notification for app } } } ALChatManager.registerNotification(); return(true); }