Integration for Xamarin


Follow the steps below

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

Download Xamarin 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 OnActivated function. You should be Logged into Invitereferrals account to see the correct values of BRANDID and ENCRYTEDKEY.

Select All

     InviteReferrals.SetupWithBrandId (BRANDID ,"ENCRYTEDKEY" );
    

Example:

Select All

    public override void OnActivated (UIApplication application)  { 
    InviteReferrals.SetupWithBrandId (52X ,"6F9CNXXXXXXXXXXXXXX" );
    }

    

Add the following function in your AppDelegate.cs file. openURL function that will check the deep linking and open your app from URL Scheme.


Select All

    public override bool OpenUrl (UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)  {
    InviteReferrals.Application (application, url, sourceApplication, annotation);
    throw new System.NotImplementedException ();
        }
    


3. Add Referral Button

Add the following line in your custom button click. Replace CampaignID with the id of the referral campaign. Default campaignID will be applied if no campaignID specified.This will launch login screen of InviteReferrals.

Select All

    InviteReferrals.Launch(“campaignID”,“email” ,”mobile” ,”name” ,”subscriptionID” );
    

If you want to auto login on click of above custom button pass the email id as an string to launch share screen directly.

For Login Screen:

Select All

    InviteReferrals.Launch(“6823”,””,””,””,”” );
    

For AutoLogin (Share Screen):

Select All

    InviteReferrals.Launch(“6823”,”tom@gmail.com”,”9818XXXXXX”,”Tom”,”” );
    

4. Show Refer a friend Popup

Just add the following line in the ViewController in which you want to show the referral program popup.

Select All

    InviteReferrals.ShowSharePopup (“page”,”email”,”mobile”,”name”,”subscriptionID” );
    

If you want to auto login from show refer friend popup pass the email id as an string to launch share screen directly.

For Login Screen:

Select All

    InviteReferrals.ShowSharePopup (“home”,””,””,””,”” );
    

For AutoLogin (Share Screen):

Select All

    InviteReferrals.ShowSharePopup (“home”,”tom@gmail.com”,”9818XXXXXX”,”Tom”,”” );
    

5. Pass User Details for Auto Login (Single Sign In)

Select All

    InviteReferrals.SetupUserId(“email”,”mobile”,”name”,”gender”,”shareLink”,”shareTitle”,”shareDesc”,”shareImg”,”customValue”, ”campaignid”,”flag”,”subscriptionID” ); 
    

Example:

Select All

    InviteReferrals.SetupUserId(“tom@gmail.coml”,”9918XXXXXX”,”Tom”,”male”,”shareLink”,”shareTitle”,”shareDesc”,”shareImg”,”customValue”,”6823”,”launch”,”” );
    

6. Tracking Install / Register / Sale Events

This is how you call tracking() method to track:

Select All

    InviteReferrals.Tracking(“eventName”,”orderID”,”purchaseValue”,”email”,”mobile”,”name”,”isDebugMode” );
    

Example:

Install

Select All

    InviteReferrals.Tracking(“install”,””,””,””,””,””, true );
    

Register

Select All

    InviteReferrals.Tracking(“register”,”tom@gmail.com”,”2000”,”devid@gmail.com”,”9818XXXXXX”,”Tom”,false );
    

Sale

Select All

    InviteReferrals.Tracking(“sale”,”123466”,”2000”,”tom@gmail.com”,”9818XXXXXX”,”Tom”,false );
    

Note: if App is on AppStore pass isDebugMode = NO in install tracking.

7. Show Welcome Message

Show welcome message to the customer if he comes through the referral of his friend.

Select All


    InviteReferrals.welcomeMessage();

    

FAQ:


You can also set background image of your choice for Invitereferrals screens to do that just rename your background image as “bg.png” and import it to your project’s Assets or simply drag and include it in your project.
    For Localise language such as Vietnamese follow the following steps.

      A.  Select your Info.plist of your Xamarin iOS project solution.Click on Add new entry and Setup a CFBundleDevelopmentRegion as a String set its value to en where en stands for English. This step will set the default supported language English if no translation supported language found default value will be used.


      B.  Add new entry and set up a CFBundleLocalizations as a Array. Add languages you want to supported by your app as the elements of above array for example if your app supports two languages English (en) and Vietnamese (vi) as the elements of the CFBundleLocalizations Array same as the following image.


      C.  Create a Resources folder in your iOS project solution and inside the Resources folder create a folder with the .lproj extension for each language and create a Localizable.strings file in each of the .lproj folder.For above example there should be two folders en.lproj and vi.lproj. Also make sure all .strings files should apply for BundleResource build action.To check that right click on .strings file >> Build Action >> BundleResource.

      D.  Now as per above example open the Localizable.strings file of en.lproj and replace its contents with the following.

      Select All

                      "Done" = "Done";
                      "OK" = "OK";
                      "Please enter your email." = "Please enter your email.";
                      "Press OK to continue" = "Press OK to continue";
                      "Please enter a valid email." = "Please enter a valid email.";
                      "Invalid authentication" = "Invalid authentication";
                      "Enter your name" = "Enter your name";
                      "Enter your Email" = "Enter your Email";
                      "Enter the Referral Program" = "Enter the Referral Program";
                      "How it works" = "How it works";
                      "Terms & Conditions" = "Terms & Conditions";
                      "Facebook not Logged In." = "Facebook not Logged In.";
                      "Please login to your facebook account first." = "Please login to your facebook account first.";
                      "Twitter not Logged In." = "Twitter not Logged In.";
                      "Please login to your twitter account first." = "Please login to your twitter account first.";
                      "WhatsApp not installed." = "WhatsApp not installed.";
                      "Your device does not have WhatsApp installed." = "Your device does not have WhatsApp installed.";
                      "Can not Send Mail" = "Can not Send Mail";
                      "Please login to your email account first." = "Please login to your email account first.";
                      "More options to share" = "More options to share";
                      "My Referral Statistics" = "My Referral Statistics";
                      

      E. Now open the Localizable.strings file of vi.lproj and replace its contents with the following.

      Select All

                      "Done" = "Làm xong";
                      "OK" = "được";
                      "Please enter your email." ="Vui lòng điền email của bạn .";
                      "Press OK to continue" = "Nhấn OK để tiếp tục";
                      "Please enter a valid email." = "Vui lòng nhập email hợp lệ.";
                      "Invalid authentication" = "xác thực không hợp lệ";
                      "Enter your name" = "Nhập tên của bạn";
                      "Enter your Email" = "Nhập email của bạn";
                      "Enter the Referral Program" = "Nhập Chương trình giới thiệu";
                      "How it works" = "Làm thế nào nó hoạt động";
                      "Terms & Conditions" = "Điều khoản và điều kiện";
                      "Facebook not Logged In." = "Facebook không Logged In.";
                      "Please login to your facebook account first." = "Xin hãy đăng nhập vào tài khoản facebook của bạn đầu tiên .";
                      "Twitter not Logged In." = "Twitter không Logged In.";
                      "Please login to your twitter account first." = "Xin hãy đăng nhập vào tài khoản twitter của bạn đầu tiên .";
                      "WhatsApp not installed." = "WhatsApp không được cài đặt .";
                      "Your device does not have WhatsApp installed." = "WhatsApp không được cài đặt .";
                      "Can not Send Mail" = "Không thể Gửi Mail";
                      "Please login to your email account first." = "Xin hãy đăng nhập vào tài khoản email của bạn đầu tiên .";
                      "More options to share" = "Nhiều tùy chọn để chia sẻ";
                      "My Referral Statistics" = "Thống kê giới thiệu của tôi";
                  

You can also customise navigation bar as your choice for Invitereferrals screens to do that just call the following m

Select All

    InviteReferrals.NavigationBarAttributesWithTitle ("Title", "Done Button Title / Image Url", "BarTextFontName", BarTitleFontSize, BarButtonFontSize, BarButtonIconWidth, BarButtonIconHeight, "Bar Background Color (RGB or Hex) / Bar Background Image URl", "Bar Tint Color in RGB / Hex");

    

Example:

Text Titles and Rgb/Hex Colors

Select All

        InviteReferrals.NavigationBarAttributesWithTitle ("Title", "Close", "Futura", 22, 18, 0, 0, "rgba(227,188,99,0.8)", "#ffffff");
        

Image Urls and Rgb/Hex Colors

Select All

        InviteReferrals.NavigationBarAttributesWithTitle("Title","https://s3.amazonaws.com/notifyvisitors/static/cross.png","",22,0,15,15,"https://d2gg9evh47fn9z.cloudfront.net/thumb_COLOURBOX8392247.jpg","#19bdce");