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); }
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; }
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); }