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 setPulsateErrorListener(listener: IPulsateErrorListener)
/**
* Call when user is logged in to your App and you want to show In Apps / allow Feed access.
* Enables in apps
* Shows last bounced in app
* Sets user as authorized
* Shows last unauthorized message
*/
fun userHasLoggedIn()
/**
* Call when user is logged out of your App and you want to hide In Apps / disallow Feed access.
* Disables in apps
* Sets user as unauthorized
*/
fun userHasLoggedOut()
fun getIPulsateSessionManager(): IPulsateSessionManager
fun getIPulsateUserManager(): IPulsateUserManager
fun getIPulsateFeedManager(): IPulsateFeedManager
fun getIPulsateInAppManager(): IPulsateInAppManager
fun getIPulsateFcmManager(): IPulsateFcmManager
fun getIPulsateLocationManager(): IPulsateLocationManager
}
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)
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
*/
fun setBadgeUpdateListener(listener: IPulsateBadgeUpdateListener?)
}
interface IPulsateFeedManager {
/**
* Opens the Pulsate Feed
*/
fun showFeed()
/**
* Returns the Pulsate Feed Items
*/
fun getFeed(page: Int, listener: IPulsateValueListener<PulsateFeedState>?)
fun getUnreadCount(listener: IPulsateValueListener<Int>?)
/**
* 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 that was blocked due to setInAppNotificationEnabled(FALSE) being called.
* This method should be used after setInAppNotificationEnabled(TRUE) is called.
* The force variable by default is FALSE, if you set it to TRUE the SDK will ignore some checks and will try to force the In App to display.
* For example when force is true the In App will show even if setInAppNotificationEnabled(FALSE) was called and In Apps are disabled.
*/
fun showLastInAppNotification(force: Boolean = false)
}
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?)
}
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.
* There is nothing needed to end a session, it is handled automatically.
* Logout is not end session, do not use it to end session.
*/
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.
* There is nothing needed to end a session, it is handled automatically.
* Logout is not end session, do not use it to end session.
*
* @param alias - unique identifier in your system for this user
*/
fun startPulsateSessionForAlias(alias: String, requestListener: IPulsateRequestListener?)
/**
* Logs out the currently logged in user.
* Logout causes the current device to be detached from the user / alias.
* This means that Pulsate will no longer be able to reach this user with any campaigns.
* Pushes, In Apps, Feed Posts will not be delivered.
* The user can not be segmented based on this device data.
* This is almost like a "soft delete".
* Use only when you want to totally logout the user from Pulsate and disable all Pulsate features.
*/
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 almost instantly.
* This method is debounced to merge multiple calls into one.
*/
fun forceAttributeSync()
}