public Task <RequestResult> PostEventAsync(string anEvent, Dictionary <string, string> attributes) { var taskSource = new TaskCompletionSource <RequestResult>(); NSDictionary attrs = attributes != null?NSDictionary.FromObjectsAndKeys(attributes.Values.ToArray(), attributes.Keys.ToArray()) : new NSDictionary(); nativeManager.PostEvent(new NSString(anEvent), attrs, (error) => { taskSource.SetResult(new RequestResult { Error = PushManager.ErrorFromNSError(error) }); }); return(taskSource.Task); }
// // 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) { window = new UIWindow(UIScreen.MainScreen.Bounds); viewController = new PushwooshSampleViewController(); window.RootViewController = viewController; window.MakeKeyAndVisible(); PushNotificationManager pushmanager = PushNotificationManager.PushManager; _pushDelegate = new PushDelegate(); pushmanager.Delegate = _pushDelegate; //pushmanager.Language = (NSString)"es"; if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { UNUserNotificationCenter.Current.Delegate = pushmanager.NotificationCenterDelegate; } if (options != null) { if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) { pushmanager.HandlePushReceived(options); } } pushmanager.SendAppOpen(); pushmanager.RegisterForPushNotifications(); //Start tracking Geozones PWGeozonesManager.SharedManager.StartLocationTracking(); pushmanager.SetUserId(new NSString("%userId%")); pushmanager.PostEvent(new NSString("applicationFinishedLaunching"), new NSDictionary("attribute", "value")); PWInAppManager inappManager = PWInAppManager.SharedManager; inappManager.AddJavascriptInterface(new JavaScriptInterface(), new NSString("jsInterface")); inappManager.PostEvent(new NSString("1"), new NSDictionary()); Console.WriteLine("HWID: " + pushmanager.HWID); return(true); }