-
public class CTWebInterfaceThis class helps WebViews to interact with CleverTapAPI via pre-defined methods
-
-
Constructor Summary
Constructors Constructor Description CTWebInterface(CleverTapAPI instance)CTWebInterface(CleverTapAPI instance, CTInAppBaseFragment inAppBaseFragment)
-
Method Summary
Modifier and Type Method Description voidpromptPushPermission(boolean shouldShowFallbackSettings)Method to be called from WebView Javascript to request permission for notificationfor Android 13 and above voiddismissInAppNotification()Method to be called from WebView Javascript to dismiss the InApp notification voidaddMultiValueForKey(String key, String value)Method to be called from WebView Javascript to add profile properties in CleverTap voidincrementValue(String key, double value)Method to be called from WebView Javascript to increase the value of a particular property. voiddecrementValue(String key, double value)Method to be called from WebView Javascript to decrease the value of a particular property. voidaddMultiValuesForKey(String key, String values)Method to be called from WebView Javascript to add profile properties in CleverTap voidpushChargedEvent(String chargeDetails, String items)Method to be called from WebView Javascript to raise Charged event in CleverTap voidpushEvent(String eventName)Method to be called from WebView Javascript to raise event in CleverTap voidpushEvent(String eventName, String eventActions)Method to be called from WebView Javascript to raise event with event properties in CleverTap voidpushProfile(String profile)Method to be called from WebView Javascript to push profile properties in CleverTap voidremoveMultiValueForKey(String key, String value)Method to be called from WebView Javascript to remove profile properties in CleverTap voidremoveMultiValuesForKey(String key, String values)Method to be called from WebView Javascript to remove profile properties in CleverTap voidremoveValueForKey(String key)Method to be called from WebView Javascript to remove profile properties for given key in CleverTap voidsetMultiValueForKey(String key, String values)Method to be called from WebView Javascript to set profile properties in CleverTap voidonUserLogin(String profile)Method to be called from WebView Javascript to push profile/properties in CleverTap afterUser Login voidtriggerInAppAction(String actionJson, String callToAction, String buttonId)Trigger an in-app action (close, open url, button click, custom template, key-value). intgetSdkVersion()Retrieve the version code of the CleverTap SDK. -
-
Constructor Detail
-
CTWebInterface
CTWebInterface(CleverTapAPI instance)
-
CTWebInterface
CTWebInterface(CleverTapAPI instance, CTInAppBaseFragment inAppBaseFragment)
-
-
Method Detail
-
promptPushPermission
void promptPushPermission(boolean shouldShowFallbackSettings)
Method to be called from WebView Javascript to request permission for notificationfor Android 13 and above
-
dismissInAppNotification
void dismissInAppNotification()
Method to be called from WebView Javascript to dismiss the InApp notification
-
addMultiValueForKey
void addMultiValueForKey(String key, String value)
Method to be called from WebView Javascript to add profile properties in CleverTap
-
incrementValue
void incrementValue(String key, double value)
Method to be called from WebView Javascript to increase the value of a particular property.The key must hold numeric value
-
decrementValue
void decrementValue(String key, double value)
Method to be called from WebView Javascript to decrease the value of a particular property.The key must hold numeric value
-
addMultiValuesForKey
void addMultiValuesForKey(String key, String values)
Method to be called from WebView Javascript to add profile properties in CleverTap
-
pushChargedEvent
void pushChargedEvent(String chargeDetails, String items)
Method to be called from WebView Javascript to raise Charged event in CleverTap
- Parameters:
chargeDetails- Stringified JSONObject of charged event detailsStringified JSONObject will be converted to a HashMapitems- A Stringified JSONArray which contains up to 15 JSON Object objects,where each JSON Object object describes a particular item purchasedJSONArray of JSONObjects will be converted to an ArrayList of,
-
pushEvent
void pushEvent(String eventName)
Method to be called from WebView Javascript to raise event in CleverTap
- Parameters:
eventName- String value of event name
-
pushEvent
void pushEvent(String eventName, String eventActions)
Method to be called from WebView Javascript to raise event with event properties in CleverTap
- Parameters:
eventName- String value of event nameeventActions- Stringified JSONObject of event properties
-
pushProfile
void pushProfile(String profile)
Method to be called from WebView Javascript to push profile properties in CleverTap
- Parameters:
profile- Stringified JSONObject of profile properties
-
removeMultiValueForKey
void removeMultiValueForKey(String key, String value)
Method to be called from WebView Javascript to remove profile properties in CleverTap
-
removeMultiValuesForKey
void removeMultiValuesForKey(String key, String values)
Method to be called from WebView Javascript to remove profile properties in CleverTap
-
removeValueForKey
void removeValueForKey(String key)
Method to be called from WebView Javascript to remove profile properties for given key in CleverTap
- Parameters:
key- String value of profile property key
-
setMultiValueForKey
void setMultiValueForKey(String key, String values)
Method to be called from WebView Javascript to set profile properties in CleverTap
-
onUserLogin
void onUserLogin(String profile)
Method to be called from WebView Javascript to push profile/properties in CleverTap afterUser Login
- Parameters:
profile- Stringified JSONObject of profile properties
-
triggerInAppAction
void triggerInAppAction(String actionJson, String callToAction, String buttonId)
Trigger an in-app action (close, open url, button click, custom template, key-value). This method will alsopush a "Notification Clicked" event for the currently displayed in-app notification. The notification will bedismissed after the action is triggered.
- Parameters:
actionJson- Stringified JSON of the action that is triggeredcallToAction- A string that will be stored as param to the "Notification Clicked" eventbuttonId- A string that will be stored as param to the "Notification Clicked" event
-
getSdkVersion
int getSdkVersion()
Retrieve the version code of the CleverTap SDK.
-
-
-
-