Notifyvisitors Xamarin Documentation



SDK source can be downloaded from here

Download Android Xamrine SDK

1. Integrate the sdk

Extract the notifyvisitors.zip file ,open notifyvisitors/dll folder copy Notifyvisitors.dll add it as a reference to your app



2. Configure your AndroidManifest.xml

Select All


<manifest....>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
 <uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<permission android:name="com.notifyvisitors.nvsdklive.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.notifyvisitors.nvsdklive.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />   <aplication....>
<meta-data android:name="notifyvisitors_bid" android:value="52X" ></meta-data>
<meta-data android:name="notifyvisitors_bid_e" android:value="768B370B0002A3DEE5E8CD991DA80A12" ></meta-data>


3. Initializing the sdk

a) If you don’t have your own application class, then in the manifest file register our application class like this in application tag:

Select All


<aplication android:name="com.notifyvisitors.notifyvisitors.NotifyVisitorsApplication"></application>

b) If you have your own application class then inside your application class onCreate method, call our register method like this:


Select All

NotifyVisitorsApplication.Register(this);

4. Showing InApp Notifications

To show in app popups in your app, you can call the Show() method like this:-

Select All

  
NotifyVisitorsApi.GetInstance(this).Show(null,null,null);


5. Showing Notification Center

To show notification center in your app, you can call the ShowNotification() method like this:-

Select All


NotifyVisitorsApi.GetInstance(this).ShowNotifications(0);

You may then set rules in the inviteReferrals campaign settings to show campaign popup after specific time delay or after specific number of App launches on this view.



6. Showing Instant Push Notification

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

Select All

    NotifyVisitorsApi.GetInstance(this).ScheduleNotification(String nid, String tag, String time,String title, String message,String url, String icon);



where:

Select All

nid  is the id of the notification.
tag is a unique tag(string value)
time is the time delay after which notification has to be shown
title is the title of notification.
message is the message of notification.
url is the package name of the activity to be open on click of the notification.
icon is the link of the image to be shown as image on the notification.
** nid, tag and time are mandatory fields.
 


7. Tracking events

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

Select All

   NotifyVisitorsApi.GetInstance(getActivity()).Event(String eventName, JSONArray attributes, String ltv, String scope);

where:

Select All

eventName is the name of the event you want to track for example “sale”,
attributes is the json array containing different properties of the event in the form of json object like:-
JSONArray eventArray = new JSONArray();
JSONObject price = new JSONObject();
JSONObject category = new JSONObject();
try {
price.put("price","20000");
category.put("firstCategory","standard");
category.put("secondCategory","fancy");
} catch (JSONException e) {
    e.printStackTrace();
}
eventArray.put(price);
eventArray.put(category);


Ltv is the value you want to give to user corresponding to every particular event.
SCOPE- 1. (called every time the function is called)
2. (called once for the session)
3. (called once per lifetime)

8. User Identifiers

To identify the different app users, call the method UserIdentifier like:-

Select All

   NotifyVisitorsApi.GetInstance(getActivity()).UserIdentifier(String userID, JSONArray jsonArray);

where:

Select All

userID is the unique identifier to identify different users like email, contact number or any other custom user id,
jsonArray is the json array containing user information in the form of json object like:-
JSONArray jsonArray = new JSONArray();
JSONObject name = new JSONObject();
JSONObject number = new JSONObject();
try {
name.put("name","Basant");
number.put("number","9898765489");
} catch (JSONException e) {
    e.printStackTrace();
}
jsonArray.put(name);
jsonArray.put(number);