Package 

Class CTWebInterface


  • 
    public class CTWebInterface
    
                        

    This class helps WebViews to interact with CleverTapAPI via pre-defined methods

    • Method Summary

      Modifier and Type Method Description
      void promptPushPermission(boolean shouldShowFallbackSettings) Method to be called from WebView Javascript to request permission for notificationfor Android 13 and above
      void dismissInAppNotification() Method to be called from WebView Javascript to dismiss the InApp notification
      void addMultiValueForKey(String key, String value) Method to be called from WebView Javascript to add profile properties in CleverTap
      void incrementValue(String key, double value) Method to be called from WebView Javascript to increase the value of a particular property.
      void decrementValue(String key, double value) Method to be called from WebView Javascript to decrease the value of a particular property.
      void addMultiValuesForKey(String key, String values) Method to be called from WebView Javascript to add profile properties in CleverTap
      void pushChargedEvent(String chargeDetails, String items) Method to be called from WebView Javascript to raise Charged event in CleverTap
      void pushEvent(String eventName) Method to be called from WebView Javascript to raise event in CleverTap
      void pushEvent(String eventName, String eventActions) Method to be called from WebView Javascript to raise event with event properties in CleverTap
      void pushProfile(String profile) Method to be called from WebView Javascript to push profile properties in CleverTap
      void removeMultiValueForKey(String key, String value) Method to be called from WebView Javascript to remove profile properties in CleverTap
      void removeMultiValuesForKey(String key, String values) Method to be called from WebView Javascript to remove profile properties in CleverTap
      void removeValueForKey(String key) Method to be called from WebView Javascript to remove profile properties for given key in CleverTap
      void setMultiValueForKey(String key, String values) Method to be called from WebView Javascript to set profile properties in CleverTap
      void onUserLogin(String profile) Method to be called from WebView Javascript to push profile/properties in CleverTap afterUser Login
      void triggerInAppAction(String actionJson, String callToAction, String buttonId) Trigger an in-app action (close, open url, button click, custom template, key-value).
      int getSdkVersion() Retrieve the version code of the CleverTap SDK.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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

        Parameters:
        key - String value of profile property key
        value - String value of profile property value
      • 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

        Parameters:
        key - String value of profile property key
        value - Double value of increment
      • 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

        Parameters:
        key - String value of profile property key
        value - Double value of decrement
      • addMultiValuesForKey

         void addMultiValuesForKey(String key, String values)

        Method to be called from WebView Javascript to add profile properties in CleverTap

        Parameters:
        key - String value of profile property key
        values - Stringified JSONArray of profile property values
      • 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 HashMap
        items - 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 name
        eventActions - 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

        Parameters:
        key - String value of profile property key
        value - String value of profile property value
      • removeMultiValuesForKey

         void removeMultiValuesForKey(String key, String values)

        Method to be called from WebView Javascript to remove profile properties in CleverTap

        Parameters:
        key - String value of profile property key
        values - Stringified JSONArray of profile property values
      • 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

        Parameters:
        key - String value of profile property key
        values - Stringified JSONArray of profile property values
      • 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 triggered
        callToAction - A string that will be stored as param to the "Notification Clicked" event
        buttonId - A string that will be stored as param to the "Notification Clicked" event
      • getSdkVersion

         int getSdkVersion()

        Retrieve the version code of the CleverTap SDK.