Update User Profile(Push Profile)
Dictionary<string, string> props = new Dictionary<string, string>();
props.Add("RegistrationSource", "Android");
CleverTap.ProfilePush(props);
List<string> stringList = new List<string>();
stringList.Add("one");
stringList.Add("two");
CleverTap.ProfileSetMultiValuesForKey("multiAndroid", stringList);
Remove Multi Value For Key
List<string> stringList2 = new List<string>();
stringList2.Add("two");
CleverTap.ProfileRemoveMultiValuesForKey("multiAndroid", stringList2);
CleverTap.ProfileAddMultiValueForKey("multiAndroid", "five");
Increment a numerical value for a single-value profile property (if it exists)
CleverTap.ProfileIncrementValueForKey("score", 10); // INTEGER PROFERTY
CleverTap.ProfileIncrementValueForKey("profit", 1.5); //DOUBLE PROPERTY
Decrement a numerical value for a single-value profile property (if it exists)
CleverTap.ProfileDecrementValueForKey("score", 10); // INTEGER PROFERTY
CleverTap.ProfileDecrementValueForKey("profit", 1.5); //DOUBLE PROPERTY
Create a User profile when user logs in (On User Login)
Dictionary<string, string> newProps = new Dictionary<string, string>();
newProps.Add("email", "[email protected] ");
newProps.Add("Identity", "123456");
CleverTap.OnUserLogin(newProps);
Set Location to User Profile
CleverTap.SetLocation(34.147785, -118.144516);
CleverTap.RecordEvent("Button Clicked");
Dictionary<string, object> chargeDetails = new Dictionary<string, object>();
chargeDetails.Add("Amount", 500);
chargeDetails.Add("Currency", "USD");
chargeDetails.Add("Payment Mode", "Credit card");
Dictionary<string, object> item = new Dictionary<string, object>();
item.Add("price", 50);
item.Add("Product category", "books");
item.Add("Quantity", 1);
Dictionary<string, object> item2 = new Dictionary<string, object>();
item2.Add("price", 100);
item2.Add("Product category", "plants");
item2.Add("Quantity", 10);
List<Dictionary<string, object>> items = new List<Dictionary<string, object>>();
items.Add(item);
items.Add(item2);
CleverTap.RecordChargedEventWithDetailsAndItems(chargeDetails, items);
public void onInAppButtonClick(HashMap<String, String> payload) {
invokeMethodOnUiThread("onInAppButtonClick", payload);
}
void CleverTapInAppNotificationDismissedCallback(string message)
{
Debug.Log("unity received inapp notification dismissed: " + (!String.IsNullOrEmpty(message) ? message : "NULL"));
}
In-App Notification Controls
Suspend In-App Notifications
CleverTap.SuspendInAppNotifications();
Discard In-App Notifications
CleverTap.DiscardInAppNotifications();
Resume In-App Notifications
CleverTap.ResumeInAppNotifications();
Initialize the CleverTap App Inbox Method
CleverTap.InitializeInbox();
Debug.Log("InboxInit started");
Use the below snippet to show default CleverTap's Inbox
void LaunchInbox()
{
CleverTap.ShowAppInbox("");
}
Use the below snippet to show custom CleverTap's Inbox
Dictionary<string, object> StyleConfig = new Dictionary<string, object>();
StyleConfig.Add("navBarTitle", "My App Inbox");
StyleConfig.Add("navBarTitleColor", "#FF0000");
StyleConfig.Add("navBarColor", "#FFFFFF");
StyleConfig.Add("inboxBackgroundColor", "#AED6F1");
StyleConfig.Add("backButtonColor", "#00FF00");
StyleConfig.Add("unselectedTabColor", "#0000FF");
StyleConfig.Add("selectedTabColor", "#FF0000");
StyleConfig.Add("noMessageText", "No message(s)");
StyleConfig.Add("noMessageTextColor", "#FF0000");
//Convert the Dictionary parameters to a string and pass it to `ShowAppInbox()`
string jsonStr = JsonConvert.SerializeObject(StyleConfig, Formatting.Indented);
CleverTap.ShowAppInbox(jsonStr);
CleverTap.DismissAppInbox();
CleverTap.SetDebugLevel(CLEVERTAP_DEBUG_LEVEL);
Creating Notification Channel
void OnAndroidInit()
{
CleverTap.LaunchWithCredentialsForRegion(CLEVERTAP_ACCOUNT_ID, CLEVERTAP_ACCOUNT_TOKEN, CLEVERTAP_REGION);
CleverTap.CreateNotificationChannel("YourChannelId", "Your Channel Name", "Your Channel Description", 5, true);
}
Delete Notification Channel
CleverTap.DeleteNotificationChannel("YourChannelId");
Creating a group notification channel
CleverTap.CreateNotificationChannelGroup("YourGroupId", "Your Group Name");
Delete a group notification channel
CleverTap.DeleteNotificationChannelGroup("YourGroupId");
CleverTap.CreateNotificationChannel("YourChannelId", "Your Channel Name", "Your Channel Description", 5, true);
Half-Interstial Local In-App
Dictionary<string, object> item = new Dictionary<string, object>();
item.Add("inAppType", "half-interstitial");
item.Add("titleText", "Get Notified");
item.Add("messageText", "Please enable notifications on your device to use Push Notifications.");
item.Add("followDeviceOrientation", true);
item.Add("positiveBtnText", "Allow");
item.Add("negativeBtnText", "Cancel");
item.Add("backgroundColor", "#FFFFFF");
item.Add("btnBorderColor", "#0000FF");
item.Add("titleTextColor", "#0000FF");
item.Add("messageTextColor", "#000000");
item.Add("btnTextColor", "#FFFFFF");
item.Add("btnBackgroundColor", "#0000FF");
item.Add("imageUrl", "https://icons.iconarchive.com/icons/treetog/junior/64/camera-icon.png");
item.Add("btnBorderRadius", "2");
item.Add("fallbackToSettings", true);
CleverTap.PromptPushPrimer(item);
Dictionary<string, object> item = new Dictionary<string, object>();
item.Add("inAppType", "half-interstitial");
item.Add("titleText", "Get Notified");
item.Add("messageText", "Please enable notifications on your device to use Push Notifications.");
item.Add("followDeviceOrientation", true);
item.Add("fallbackToSettings", true);
CleverTap.PromptPushPrimer(item);
Prompt to show hard notification permission dialog.
true - fallbacks to app's notification settings if permission is denied,
false - does not fallback to app's notification settings if permission is denied
CleverTap.PromptForPushPermission(false);
Returns a boolean to indicate whether notification permission is granted or not
bool isPushPermissionGranted = CleverTap.IsPushPermissionGranted();