示例#1
0
        public override void DidReceiveNotificationRequest(UNNotificationRequest request, Action <UNNotificationContent> contentHandler)
        {
            // Init and start the sdk.
            var url        = "https://mobile.slgnt.eu/MobilePush/api/";
            var clientID   = "f06ff4cc-15c5-48b1-b405-d78dfc93f3de";
            var privateKey = "/5v3UKuFJ237PSOQy6BYtICR8+DaU/YWhjBz2JI3q8wrAIBCYt7eSWZith+sIFNWgQqdYdMx+EhYoZUa8NUsIw==";

            //  Create the SMManagerSetting instance
            var setting = SMManagerSetting.SettingWithUrl(url, clientID, privateKey);

            //Start sdk from extension
            SMManager.SharedInstance().StartExtensionWithSetting(setting);

            //FROM HERE YOU WILL HAVE TO CHOOSE THE POSSIBLE IMPLEMENTATION THAT CORRESPOND BETTER TO YOUR NEEDS

            // FIRST implementation - manage the call to the block, which is executed with the modified notification content.
            //Provide the request with the original notification content to the sdk and return the updated notification content
            //  bestAttemptContent = SMManager.sharedInstance().didReceive(request)

            //call the completion handler when done.
            //contentHandler(bestAttemptContent!)

            // SECOND implementation - let the library manage this for you.
            //Provide the request with the original notification content to the sdk and the contentHandler.
            SMManager.SharedInstance().DidReceiveNotificationRequest(request, contentHandler);
        }
        partial void buttonSendEventPressed(UIButton sender)
        {
            //  We create a custom-event
            //  Some basic events are already created for you. Please check SMHelper.h
            NSDictionary dict        = new NSDictionary <NSString, NSString>(new NSString("key"), new NSString("value"));
            SMEvent      eventCustom = SMEvent.EventWithDictionary(dict);

            SMManager.SharedInstance().SendSMEvent(eventCustom);
        }
        public void SetupUI()
        {
            //initialize with your styling options
            SMInAppContentStyleOptions options = getIACStyleOptions();
            //get the sdk SMInAppContentHTMLViewController
            SMInAppContentURLViewController urlVC = SMInAppContentURLViewController.ViewControllerForCategory("MAIN");

            //Check if IAC are available for this type and category
            if (!urlVC.IsEmpty)
            {
                //display SMInAppContentHTMLViewController in your containerView
                SMManager.SharedInstance().ShowSMController(urlVC, containerView, this);
            }
        }
示例#4
0
        public void DidReceiveNotification(UNNotification notification)
        {
            var url        = "https://mobile.slgnt.eu/MobilePush/api/";
            var clientID   = "f06ff4cc-15c5-48b1-b405-d78dfc93f3de";
            var privateKey = "/5v3UKuFJ237PSOQy6BYtICR8+DaU/YWhjBz2JI3q8wrAIBCYt7eSWZith+sIFNWgQqdYdMx+EhYoZUa8NUsIw==";

            //  Create the SMManagerSetting instance
            var setting = SMManagerSetting.SettingWithUrl(url, clientID, privateKey);

            //Start sdk from extension
            SMManager.SharedInstance().StartExtensionWithSetting(setting);

            //sdk api to add buttons from banner
            SMManager.SharedInstance().DidReceiveNotification(notification);
            label.Text = notification.Request.Content.Body;
        }
示例#5
0
        public override void TimeWillExpire()
        {
            //FROM HERE YOU WILL HAVE TO CHOOSE THE SOLUTION THAT CORRESPOND BETTER TO YOUR NEEDS

            // FIRST implementation - manage the call to the block, which is executed with the modified notification content
            //    if let contentHandler = contentHandler,
            //      let bestAttemptContent = bestAttemptContent {

            // Mark the message as still encrypted.
            //        bestAttemptContent.subtitle = "(Encrypted)"
            //      bestAttemptContent.body = ""
            //     contentHandler(bestAttemptContent)
            // }

            // SECOND implementation - let the library manage this for you.
            SMManager.SharedInstance().ServiceExtensionTimeWillExpire();
        }
示例#6
0
        void anyMethodNameDidReceiveInAppMessage(NSNotification notif)
        {
            Window = UIApplication.SharedApplication.KeyWindow;
            try
            {
                NSDictionary dict      = (NSDictionary)notif.UserInfo;
                NSArray      inAppData = (NSArray)dict.ObjectForKey(SelligentMobileiOS.Constants.kSMNotification_Data_InAppMessage);

                for (uint i = 0; i < inAppData.Count; i++)
                {
                    NSDictionary data = inAppData.GetItem <NSDictionary>(i);
                    SMManager.SharedInstance().DisplayNotificationID(data.ValueForKey(new NSString("id")).ToString());
                }
            }
            catch (Exception e)
            {
                var alertController = UIAlertController.Create("InAppMessage", "error trying to display in app message" + "\n" + e.Message + "\n" + e.StackTrace, UIAlertControllerStyle.Alert);
                //Add Action
                alertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                // Present Alert
                Window.RootViewController.PresentViewController(alertController, true, null);
            }
        }
示例#7
0
 public void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
 {
     SMManager.SharedInstance().DidFailToRegisterForRemoteNotificationsWithError(error);
 }
示例#8
0
 public void DidRegisterUserNotificationSettings(UIApplication application, UIUserNotificationSettings notificationSettings)
 {
     SMManager.SharedInstance().DidRegisterUserNotificationSettings(notificationSettings);
 }
示例#9
0
 public void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
 {
     SMManager.SharedInstance().DidRegisterForRemoteNotificationsWithDeviceToken(deviceToken);
 }
示例#10
0
        public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            UNUserNotificationCenter center = UNUserNotificationCenter.Current;

            center.Delegate = this;

            //  Don't forget to put -ObjC in Project > Build Settings > Other Linker Flags

            var url      = "https://mobile.slgnt.eu/MobilePush/api/";
            var clientId = "CLIENTID";
            var key      = "KEY";

            // Then:
            //  Create the SMManagerSetting instance
            SMManagerSetting setting = SMManagerSetting.SettingWithUrl(url, clientId, key);

            //Optional - Default value is true
            setting.ShouldClearBadge = true;
            setting.ShouldDisplayRemoteNotification = true;

            //Optional - Default value is kSMClearCache_Auto
            setting.ClearCacheIntervalValue = SMClearCache.Auto;

            // Initialise InApp Message settings - other constructors exist (cf. documentation)
            SMManagerSettingIAM iamSetting = SMManagerSettingIAM.SettingWithRefreshType(SMInAppRefreshType.Minutely, false);

            setting.ConfigureInAppMessageServiceWithSetting(iamSetting);

            // Initialise InApp Content settings - other constructors exist (cf. documentation)
            SMManagerSettingIAC iacSetting = SMManagerSettingIAC.SettingWithRefreshType(SMInAppRefreshType.Minutely);

            setting.ConfigureInAppContentServiceWithSetting(iacSetting);

            //Initialise location services - You need plot projects framework (not available in this template project)  and plotconfig.json file in your app to be able to use this - cf. documentation for more information on all available features
            setting.ConfigureLocationService();

            SMManager.SharedInstance().StartWithLaunchOptions(launchOptions, setting);

            // The following commands can be done later depending the needs of your app
            SMManager.SharedInstance().EnableInAppMessage(true);
            SMManager.SharedInstance().RegisterForRemoteNotification(); // this displays the dialog box for user to let him allow the reception of push notifications

            //Listen to differents broadcasting
            //InAppMessage broadcasting
            NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("anyMethodNameDidReceiveInAppMessage:"), SelligentMobileiOS.Constants.kSMNotification_Event_DidReceiveInAppMessage, null);

            //InAppContent broadcasting
            NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("anyMethodNameDidReceiveInAppContent:"), SelligentMobileiOS.Constants.kSMNotification_Event_DidReceiveInAppContent, null);

            //Other available braodcastings - check documentation for more informations
            NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("anyMethodNameButtonClicked:"), SelligentMobileiOS.Constants.kSMNotification_Event_ButtonClicked, null);
            NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("anyMethodNameWillDisplayNotification:"), SelligentMobileiOS.Constants.kSMNotification_Event_WillDisplayNotification, null);
            NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("anyMethodNameWillDismissNotification:"), SelligentMobileiOS.Constants.kSMNotification_Event_WillDismissNotification, null);
            NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("anyMethodNameDidReceiveRemoteNotification:"), SelligentMobileiOS.Constants.kSMNotification_Event_DidReceiveRemoteNotification, null);

            //When using a selligent push notification button with a button open method in app (this can be listened anywhere in your app)
            //"CustomActionBroadcastEvent" is an example it can be any string but it must match exactly the value you will set for the button in the push
            NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("customAction"), new NSString("CustomActionBroadcastEvent:"), null);

            return(true);
        }
示例#11
0
 public void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
 {
     SMManager.SharedInstance().DidReceiveNotificationResponse(response, completionHandler);
 }
示例#12
0
 public void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action <UNNotificationPresentationOptions> completionHandler)
 {
     SMManager.SharedInstance().WillPresentNotification(notification, completionHandler);
 }
示例#13
0
        public void OnActivated(UIApplication application)
        {
            SMDeviceInfos deviceInfos = SMDeviceInfos.DeviceInfosWithExternalId("123");

            SMManager.SharedInstance().SendDeviceInfo(deviceInfos);
        }
示例#14
0
 public void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler)
 {
     SMManager.SharedInstance().DidReceiveRemoteNotification(userInfo, completionHandler);
 }