Features
Identification
To access certain features of the DevRev SDK, user identification is required.
The identification function should be placed appropriately in your app after the user logs in. If you have the user information available at app launch, call the function after the DevRev.configure(context, appID)
method.
The Identity
structure allows for custom fields in the user, organization, and account traits. These fields must be configured through the DevRev app before they can be utilized. For more information, refer to Object customization.
Anonymous identification
The anonymous identification method allows you to create an anonymous user with an optional user identifier, ensuring that no other data is stored or associated with the user.
Kotlin
Java
Unverified identification
The unverified identification method identifies users with a unique identifier, but it does not verify their identity with the DevRev backend.
Kotlin
Java
The function accepts the DevRev.Identity
structure, with the user identifier (userID
) as the only required property, all other properties are optional.
For example:
Kotlin
Java
Verified identification
The verified identification method is used to identify the user with a unique identifier and verify the user’s identity with the DevRev backend.
Kotlin
Java
Updating the user
To update a user’s information, use the following method:
Kotlin
Java
The function accepts the DevRev.Identity
ojbect.
The userID
property cannot be updated.
Logout
You can perform a logout of the current user by calling the following method:
Kotlin
Java
The user will be logged out by clearing their credentials, as well as unregistering the device from receiving push notifications, and stopping the session recording.
PLuG support chat
Once user identification is complete, you can start using the chat (conversations) dialog supported by our DevRev SDK. To open the chat dialog, your application should use the showSupport
API, as shown in the following example:
Kotlin
Java
Creating a new conversation
You have the ability to create a new conversation from within your app. The method will show the support chat screen and create a new conversation at the same time.
Kotlin
Java
The DevRev SDK also provides a support button, which can be integrated into your application. To include it on the current screen, add the following code to your XML layout:
The support button can be customized using default parameters, enabling you to tailor its appearance to your application’s design.
and
At this stage, your app is fully configured to utilize all functionalities of the DevRev SDK. Pressing the support button directs the user to the chat interface, enabling effective interaction and support.
In-app link handling
The DevRev SDK provides a mechanism to handle links opened from within any screen that is part of the DevRev SDK.
You can fully customize the link handling behavior by setting the specialized in-app link handler. That way you can decide what should happen when a link is opened from within the app.
Kotlin
Java
You can further customize the behavior by setting the setShouldDismissModalsOnOpenLink
boolean flag. This flag controls whether the DevRev SDK should dismiss the top-most modal screen when a link is opened.
Kotlin
Java
For example:
Kotlin
Java
Analytics
The DevRev SDK allows you to send custom analytic events by using a name and a string dictionary. You can track these events using the following function:
Kotlin
Java
For example:
Kotlin
Java
Session analytics
The DevRev SDK provides observability features to help you understand how your users are interacting with your app.
Opt in or out
Session analytics features are opted-in by default, enabling them from the start. However, you can opt-out using the following method:
Kotlin
Java
To opt back in, use the following method:
Kotlin
Java
You can check whether session monitoring has been enabled by using this property:
If session recording was disabled for the user using the stopAllMonitoring()
method, you can enable recording at runtime with this method.
Kotlin
Java
If the user was disabled for session recording by using the stopAllMonitoring() method, you can use this method to enable recording at runtime.
This feature will only store a monitoring permission flag, it will not provide any UI or dialog.
Session recording
You can enable session recording to capture user interactions with your app.
The session recording feature is opt-out and is enabled by default.
Here are the available methods to help you control the session recording feature:
Using this property will return the status of the session recording:
Kotlin
Java
To check if on-demand sessions are enabled, use:
Kotlin
Java
Session properties
You can add custom properties to the session recording to help you understand the context of the session. The properties are defined as a dictionary of string values.
Kotlin
Java
To clear the session properties in scenarios such as user logout or when the session ends, use the following method:
Kotlin
Java
Masking sensitive data
To protect sensitive data, the DevRev SDK provides an auto-masking feature that masks data before sending to the server. Input views such as text fields, text views, and web views are automatically masked.
While the auto-masking feature may be sufficient for most situations, you can manually mark/unmark additional views as sensitive.
Mask
Using tag
Use Tag method only when you don’t have any other tag already applied to your UI element.
For example:
You can also set the tag programmatically:
Kotlin
Java
Using API
Kotlin
Java
For example:
Kotlin
Java
Unmask
Using tag
Use Tag method only when you don’t have any other tag already applied to your UI element.
For example:
You can also set the tag programmatically:
Kotlin
Java
Using API
Kotlin
Java
For example:
Kotlin
Java
Mask jetpack compose views
If you want to mask any Jetpack Compose UI element(s) or view(s), you can apply a mask on it using a modifier.
For example:
Mask webView elements
If you wish to mask any WebView element on a Web page explicitly, you can mask it by using class ‘devrev-mask’
For example:
Unmask webView elements
If you wish to explicitly un-mask any manually masked WebView element, you can un-mask it by using class ‘devrev-unmask’
For example:
Timers
The DevRev SDK offers a timer mechanism to measure the time spent on specific tasks, allowing you to track events such as response time, loading time, or any other duration-based metrics.
The mechanism works using balanced start and stop methods that both accept a timer name and an optional dictionary of properties.
To start a timer, use the following method:
Kotlin
Java
To stop a timer, use the following method:
Kotlin
Java
For example:
Kotlin
Java
Screen tracking
The DevRev SDK offers automatic screen tracking to help you understand how users navigate through your app. Although view controllers are automatically tracked, you can manually track screens using the following method:
Kotlin
Java
For example:
Kotlin
Java
Screen transition management
The DevRev SDK allows tracking of screen transitions to understand user navigation within your app. You can check if a screen transition is in progress and manually update the state using the following methods:
Check if the screen is transitioning
Kotlin
Java
Set screen transitioning state
Kotlin
Java
Push notifications
You can configure your app to receive push notifications from the DevRev SDK. The SDK is designed to handle push notifications and execute actions based on the notification’s content.
The DevRev backend sends push notifications to your app to notify users about new messages in the PLuG support chat.
To receive push notifications, you need to configure your DevRev organization by following the instructions in the push notifications section.
You need to ensure that your Android app is configured to receive push notifications. To set it up, follow the Firebase documentation.
Register for push notifications
Push notifications require that the SDK has been configured and the user has been identified (unverified and anonymous users). The user identification is required to send the push notification to the correct user.
The DevRev SDK offers a method to register your device for receiving push notifications. You can register for push notifications using the following method:
Kotlin
Java
The method requires a device identifier that persists across device restarts and app launches. This could be a Firebase installation ID, Android ID, or a unique system identifier. To obtain the device token for Firebase Cloud Messaging, follow these steps:
- Use the
FirebaseMessaging
object. - Call the
firebaseMessaging.token.await()
method.
This method will generate and return the device token.
Unregister from push notifications
If your app no longer needs to receive push notifications, you can unregister the device.
Use the following method to unregister the device:
The method requires the device identifier, which should be the same as the one used when registering the device.
Kotlin
Java
The method requires the device identifier, which should be the same as the one used when registering the device.
Handle push notifications
The DevRev SDK currently does not support automatic handling of push notifications. To open the PLuG chat and manage navigation internally, you must pass the message payload received in the notification to the SDK.
Kotlin
Java
To extract the notification payload, do the following:
- In Firebase Cloud Messaging (FCM), when a push notification is received, it triggers the
onMessageReceived
function in yourFirebaseMessagingService
class. - This function receives a
RemoteMessage
object as a parameter, which contains the notification data. - The
RemoteMessage
object has adata
property, which is a map containing key-value pairs of the notification payload. - To extract a specific piece of data from the payload, use the key to access the value in the data map.
- To retrieve the “message” from the payload:
Kotlin
Java
For example: