The IPulsateManager bridges other Pulsate interfaces into one. All methods from all interfaces can be found below. You can also look at all of these methods in Android Studio.
interface IPulsateManager : IPulsateSessionManager, IPulsateUserManager, IPulsateFeedManager,
IPulsateInAppManager, IPulsateFcmManager, IPulsateLocationManager {
fun getIPulsateSessionManager(): IPulsateSessionManager
fun getIPulsateUserManager(): IPulsateUserManager
fun getIPulsateFeedManager(): IPulsateFeedManager
fun getIPulsateInAppManager(): IPulsateInAppManager
fun getIPulsateFcmManager(): IPulsateFcmManager
fun getIPulsateLocationManager(): IPulsateLocationManager
}
package com.pulsatehq.external.pulsate.manager.sub
import com.pulsatehq.external.pulsate.common.PulsateAuthData
import com.pulsatehq.external.pulsate.listener.IPulsateRequestListener
interface IPulsateSessionManager {
/**
* Sets the Authorization Data for the app.
* Authorization Data is used to connect to the SDK API and send requests.
*
* @param authData - APP_ID and APP_KEY
*/
fun setAuthorizationData(authData: PulsateAuthData)
/**
* Starts Pulsate session lifecycle.
* The first session must be started by the Developer,
* all future sessions will be handled automatically if "logoutCurrentAlias" is NOT called.
*
* Starting a session in the *"onCreate()"* method of your Application class is not supported.
* Pulsate requires an active activity to start, so wait for the first Activity "*onCreate*" callback before starting a session.
*
* Session starts when the app enters foreground and ends when it goes to background.
*/
fun startPulsateSession(requestListener: IPulsateRequestListener?)
/**
* Starts Pulsate session lifecycle, for the given user.
* The first session must be started by the Developer,
* all future sessions will be handled automatically if "logoutCurrentAlias" is NOT called.
*
* Starting a session in the *"onCreate()"* method of your Application class is not supported.
* Pulsate requires an active activity to start, so wait for the first Activity "*onCreate*" callback before starting a session.
*
* Session starts when the app enters foreground and ends when it goes to background.
*
* @param alias - unique identifier in your system for this user
*/
fun startPulsateSessionForAlias(alias: String, requestListener: IPulsateRequestListener?)
/**
* Logs out the currently logged in user.
* To login an user use startPulsateSessionForAlias(String alias).
*/
fun logoutCurrentAlias(requestListener: IPulsateRequestListener?)
}
interface IPulsateUserManager {
/**
* Updates the user's first name. Gets updated when entering background.
*
* @param firstName firstName - can't be nil
*/
fun updateFirstName(firstName: String)
/**
* Updates the user's last name. Gets updated when entering background.
*
* @param lastName lastName - can't be nil
*/
fun updateLastName(lastName: String)
/**
* Updates the user's email. Gets updated when entering background.
*
* @param email email - can't be nil
*/
fun updateEmail(email: String)
/**
* Updates the user's phone number. Gets updated when entering background.
* Specify the phone number using the E.164 format. E.164 is a standard for the phone number structure used for international telecommunication.
* Phone numbers that follow this format can have a maximum of 15 digits, and they are prefixed with the plus character (+) and the country code.
* For example, a contact in the United States has a country code "1" , area code "408" and phone number "XXX-XXXX", you'd enter +1408XXXXXXX.
* @param phoneNumber phoneNumber - can't be nil
*/
fun updatePhoneNumber(phoneNumber: String)
/**
* Updates user's gender. Gets updated when entering background.
* Values:
* PulsateGender.FEMALE
* PulsateGender.MALE
*
* @param gender user's gender - cant' be null
*/
fun updateGender(gender: PulsateGender)
/**
* Updates user's age. Gets updated when entering background.
*
* @param age user's age - can't be nil
*/
fun updateAge(age: String)
/**
* Updates user's privacy. Gets updated in realtime.
* Values:
* PulsatePrivacy.UNSUBSCRIBE
* PulsatePrivacy.SUBSCRIBE
*
* @param privacy user's privacy - can't be null
*/
fun setPrivacy(privacy: PulsatePrivacy)
fun getPrivacy(listener: IPulsateValueListener<PulsatePrivacy>?)
/**
* Creates a custom attribute with a string. Neither can be nil. Gets updated when entering background.
*
* @param attributeName custom attribute name
* @param attributeValueString attribute value
*/
fun createAttribute(attributeName: String, attributeValueString: String)
/**
* Creates a custom attribute with an integer. Key can't be nil. Gets updated when entering background.
*
* @param attributeName custom attribute name
* @param attributeValueInt attribute value
*/
fun createAttribute(attributeName: String, attributeValueInt: Int)
/**
* Creates a custom attribute with a float. Key can't be nil. Gets updated when entering background.
*
* @param attributeName custom attribute name
* @param attributeValueFloat attribute value
*/
fun createAttribute(attributeName: String, attributeValueFloat: Float)
/**
* Creates custom attribute with a bool. Key can't be nil. Gets updated when entering background.
*
* @param attributeName custom attribute name
* @param attributeValueBool attribute value
*/
fun createAttribute(attributeName: String, attributeValueBool: Boolean)
/**
* Creates custom attribute with a date. Key can't be nil. Gets updated when entering background.
*
* @param attributeName custom attribute name
* @param attributeValueDate attribute value
*/
fun createAttribute(attributeName: String, attributeValueDate: Date)
/**
* Sends a custom in app event
*
* @param event event to be sent - can't be nil
*/
fun createEvent(event: String)
/**
* Sends a list of custom in app events
*
* @param events events to be sent - can't be nil
*/
fun createEvents(events: List<String>)
/**
* Sends a revenue event
*
* @param event event to be sent - can't be nil
*/
fun createRevenueEvent(event: PulsateRevenueEvent)
/**
* Sends a list of revenue events
*
* @param events events to be sent - can't be nil
*/
fun createRevenueEvents(events: List<PulsateRevenueEvent>)
/**
* Increments given integer attribute by given value. Gets updated when entering background.
*
* @param counterName which attribute to increment
* @param value value to increment by
*/
fun incrementCounter(counterName: String, value: Int)
/**
* Decrements given integer attribute by given. Gets updated when entering background.
*
* @param counterName custom attribute name
* @param value attribute value
*/
fun decrementCounter(counterName: String, value: Int)
/**
* Attributes synchronize when the app is entering background.
* This method forces the synchronization to happen instantly.
*/
fun forceAttributeSync()
}
interface IPulsateFeedManager {
/**
* Opens the Pulsate Feed
*/
fun showFeed()
/**
* Returns the Pulsate Feed Items
*/
fun getFeed(page: Int, listener: IPulsateValueListener<PulsateFeedState>?)
/**
* When using void getFeed(int page, IPulsateValueListener<PulsateFeedState> listener);
* We recommend using this method to pass user onClick events to Pulsate to properly handle it.
* Pulsate will make sure that the click does what it should do - open url, open deeplink, send custom events, record opens / clicks
</PulsateFeedState> */
fun handleFeedClick(pulsateFeedItem: PulsateFeedItem, destination: Int)
/**
* Enables or Disables the New Thread Button in the Pulsate Inbox
*/
fun setNewThreadButtonEnabled(enabled: Boolean)
fun isNewThreadButtonEnabled(listener: IPulsateValueListener<Boolean>?)
/**
* Enables or Disables using the user initials as the user avatar.
* When disabled the avatar will always be an anon icon.
* By default enabled
*
* @param useInitials - true or false
*/
fun useInitialsForUserAvatar(useInitials: Boolean)
fun isUseInitialsEnabled(listener: IPulsateValueListener<Boolean>?)
/**
* Sets the user to either be authorized or unauthorized to view the inbox.
*/
fun setUserAuthorized(authorized: Boolean)
fun isUserAuthorized(listener: IPulsateValueListener<Boolean>?)
/**
* Sets a listener that receives callback when an unauthorized action happens.
*/
fun setUserUnauthorizedListener(listener: IPulsateUserUnauthorizedListener?)
/**
* Shows the last blocked inbox action - single card view, inbox entry, thread entry
*/
fun showLastUnauthorizedMessage()
/**
* Developers can now add an additional button in the Pulsate Feed. The button will appear in the main Feed Toolbar in the right corner.
* To add this button you need to add a new drawable called "ic_pulsate_inbox_toolbar_right_button"and call the new *setOnInboxRightButtonClickListener* method and pass an *OnClickListener*.
* This should be done in the Application class under *onCreate()*.
*
* @param listener - OnClickListener for inbox button
*/
fun setOnInboxRightButtonClickListener(listener: View.OnClickListener?)
}
interface IPulsateInAppManager {
/**
* Enables or Disables In-App Notifications. Default - Enabled
*/
fun setInAppNotificationEnabled(enabled: Boolean)
fun isInAppNotificationEnabled(listener: IPulsateValueListener<Boolean>?)
/**
* Sets the duration of small in app notifications. Default - 12s
*/
fun setSmallInAppNotificationDuration(seconds: Int)
fun getSmallInAppNotificationDuration(listener: IPulsateValueListener<Int>?)
/**
* Shows the last in app notification. In App Notification need to be enabled.
* To enable in app notifications use enableInAppNotification(BOOL).
*/
fun showLastInAppNotification()
}
interface IPulsateFcmManager {
/**
* Use to send the FCM Payload to Pulsate.
* Pulsate will check the Payload and handle it if it is a Pulsate Payload.
* @param remoteMessage - FCM remoteMessage
* @return true if Pulsate was able to handle the Push Payload
*/
fun onMessageReceived(remoteMessage: RemoteMessage?): Boolean
/**
* Use to send the FCM New Token to Pulsate.
* @param token - FCM Token
*/
fun onNewToken(token: String)
/**
* Disables or Enables push notifications from Pulsate.
*
* @param enabled - true or false
*/
fun setPushNotificationEnabled(enabled: Boolean)
/**
* Queries the server to check if push notifications are enabled for the given alias
*/
fun isPushNotificationEnabled(listener: IPulsateValueListener<Boolean>?)
/**
* Sets a listener that receives updates about badge count from Pulsate.
* The SDK updates the badge count on 3 events:
* 1. On leaving the Pulsate Inbox
* 2. On Pulsate Session Start
* 3. On getting a Push Notification
* Note - This method will always return 0 and will reset badge count if the Pulsate Web App is set to clear unread count on accessing the inbox.
*/
fun setBadgeUpdateListener(listener: IPulsateBadgeUpdateListener?)
}
interface IPulsateLocationManager {
/**
* Shows a popup that will explain to the user why the App needs location
* And will ask him to allow the location permission.
* BETA DO NOT USE!
*/
fun askForLocationPermission(activity: Activity, @IntRange(from = 0) requestCode: Int)
/**
* Shows a popup that will explain to the user why the App needs background location
* And will ask him to allow the background location permission.
* BETA DO NOT USE!
*/
fun askForBackgroundLocationPermission(activity: Activity, @IntRange(from = 0) requestCode: Int)
/**
* Enables or Disables Geofencing and Beacon Scanning.
* By default enabled.
*/
fun setLocationUpdatesEnabled(enabled: Boolean)
fun isLocationUpdatesEnabled(listener: IPulsateValueListener<Boolean>?)
/**
* Enables or Disables sending the user location when a beacon event happens.
* By default this it disabled
*
* @param enabled - true or false
*/
fun sendLocationWithBeaconEvents(enabled: Boolean)
fun isLocationWithBeaconEvents(listener: IPulsateValueListener<Boolean>?)
/**
* Returns the last known location of the user
*/
fun getLastKnownLocation(listener: IPulsateValueListener<Location>?)
/**
* Sets a listener that receives enter/exit/dwell geofence callbacks from Pulsate.
*
* @param listener listener that will receive callbacks from Pulsate
*/
fun setGeofenceListener(listener: IPulsateGeofenceListener?)
}