Integration for Xamarin code

Follow the steps below Download the xamarin ios library from download link and add the library project to your project Solution.

Download IOS SDK

Double click on Reference and goto PROJECTS tab and select Invitereferrals and click on OK button.Now Invitereferrals should be shown in Reference folder as following image.

1. Configure your info.plist

Goto info.plist click on Source tab.

2. Initialise the SDK

Initialize the sdk in application didFinishLaunchingWithOptions function. You should be Logged into Notify Visitors account to see the correct values of BRANDID and SECRETEKEY

notifyvisitors.SetupWithBrandId (BRANDID, ”SECRETKEY” );


public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)  {
notifyvisitors.SetupWithBrandId (52X  , "768B370B0002A3DEE5E8CD991DA80A12");                

Add the following method in application didFinishLaunchingWithOptions to register your app for push notification and geofencing

notifyvisitors.RegisterForPushNotificationWithBrandId (BRANDID , ”SECRETKEY”  );


notifyvisitors.RegisterForPushNotificationWithBrandId (52X , "768B370B0002A3DEE5E8CD991DA80A12");

Add the following inside FinishedLaunching function to handle push notification and geofencing when your app is either in background state or terminated.


if (launchOptions != null) { 
  notifyvisitors.HandlePushWhenAppTerminated (application, launchOptions);

Add the following three function inside your AppDelegate file to handle the registering and receiving events of push notification

public override void DidRegisterUserNotificationSettings (UIApplication application, UIUserNotificationSettings notificationSettings)   {
application.RegisterForRemoteNotifications (); 
 public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)   {
 notifyvisitors.DidRegisteredNotification (application, deviceToken);   
public override void FailedToRegisterForRemoteNotifications (UIApplication application, NSError error)  {
new UIAlertView ("Error registering push notifications", error.LocalizedDescription, null, "OK", null).Show ();  
public override void DidReceiveRemoteNotification (UIApplication application, NSDictionary userInfo, System.Action completionHandler) {
 notifyvisitors.DidReceiveNotifyvisitorsPushNotification (application, Window, userInfo);

To handle the geofencing notifications in background state and Inactive state of application add the following code in applicationDidEnterBackground and applicationDidBecomeActive respectively

public override void DidEnterBackground (UIApplication application)  {
notifyvisitors.NotifyVisitorsGeofencingApplicationDidEnterBackground ();
public override void OnActivated (UIApplication application)   {
notifyvisitors.NotifyVisitorsGeofencingapplicationDidBecomeActive ();    

Add the following Code to receive local notification when geofencing events trigger.

public override void ReceivedLocalNotification (UIApplication application, UILocalNotification notification) { notifyvisitors.NotifyVisitorsGeofencingReceivedNotificationWithApplication (application, Window, notification); 

Call the following function in your AppDelegate openURL function that will check the deep linking and open your app from URL Scheme

notifyvisitors.Application (application, url, sourceApplication, annotation, BRANDID, ”SECRETKEY” );


public override bool OpenUrl (UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)   {
notifyvisitors.Application (application, url, sourceApplication, annotation, 52X , "768B370B0002A3DEE5E8CD991DA80A12" );
throw new System.NotImplementedException ();  

Give the Storyboard ID to all of your View Controller same as its name for example if you have a View Controller named HomeViewController then it's Stroryboard ID should be HomeViewController. Do it for all view controllers in storyboard.

3.Showing In-App Notifications

Use following function to show in app popups. Pass the User Token & CustomRule as NSMutableDictionary or pass nil

var userTokens = new NSMutableDictionary ();
var customRules = new NSMutableDictionary ();
notifyvisitors.Show (userTokens  , customRules  ); 

If you are using UIScrollView use the following function in your ScrollView delegate method ScrollViewDidScroll to View Notification on specific scroll position

var YourScrollView = new UIScrollView ();
this.YourScrollView.Scrolled += (sender, args) => {  
        notifyvisitors.ScrollViewDidScroll (YourScrollView);      };

If you need to dismiss all inApp notifications currently viewing on screen, you can call DismissAllNotifyvisitorsInAppNotifications method like this:-


4. User Identifiers

To identify the different app users, call the method userIdentifier as follows.

var jsonDataMutableDictionary = new NSMutableDictionary ();
notifyvisitors.UserIdentifier ("userID"  , jsonDataMutableDictionary  );

5. Showing Notification Center

You can show list of push notification received push notifications in an In-app Notification Center. To launch In-app notification center you can call the following method.

notifyvisitors.NotifyVisitorsNotificationCentre ();

6. Showing Instant Push Notification

To show instant push notification in your app, you can call the schedulePushNotificationwithNotificationID method like this:-

notifyvisitors.SchedulePushNotificationwithNotificationId ("39", "Tag1234", "2", "SchedulePushTitle", "SchedulePushMessage", "http://urllink.domain", "http://iconimageurl.domain"  );

7. Tracking events

To track the various app events, call the method event like:-

notifyvisitors.TrackEvents ("eventName",AttributesDictionary Attributes, ”Ltv”, scope);

Where: eventName is the name of the event you want to track for example “sale”,

AttributesDictionary is the json (Key Value Pair) containing different properties of the event in the form of json object like:-

var AttributesDictionary = new NSMutableDictionary ();
AttributesDictionary.Add ((NSString)"price", (NSString)"2000" );
AttributesDictionary.Add ((NSString)"Category", (NSString)"fancy"  );

Ltv is the value you want to give to user corresponding to every particular event.

scope - 1 (called every time the function is called)

scope -2(called once for the session)

scope -3 (called once per lifetime)

8. Handle Call to Action Manually

This point is optional if your apps action button action not working to load your app’s view controller you can handle it yourself using NSNotificationCenter to do that add the following code anywhere in your app recommended is inside viewDidLoad of first View Controller.

NSNotificationCenter.DefaultCenter.AddObserver (this, new Selector ("triggerNotification:"), (NSString)"NVInAppViewConroller", null);

From above code your app will be notified on tap on action button if you set action button to open your in-app view controller on notifyvisitors control panel and now you can be able to handle the action as following method.

[Export ("triggerNotification:")]
public void triggerNotification (NSNotification n)  {
Console.WriteLine ("received notification is = "+ n.UserInfo);
// Do your stuffs here……………………………………………………………