Pulse Unicorn is an extension over Android event SDK It makes your life easier!
1.1.8
The purpose of this project is to help with Pulse Tracking development and maintenance using
Android event SDK library.
This extension allows quick examination of traffic that is sent by event-sdk
library.
Pulse Unicorn provides basic UI that displays events in list, so that you can verify, if events send
by your app are implemented and sent exactly as you wanted them to be implemented.
- Watch for ongoing events in the real time in a easy to read format
- Easy opening by tapping the notification
- Quick overview for number of collected events via notification information
- Receive notification about invalid / failed events
- Search across events by any matching phrase
- Search for any value in event Json body in event details view
- Add any custom Json property display in event cell for easy quick value debugging
- Filter events by default pulse
EVENT_TYPE
,OBJECT_TYPE
,TRACKER_TYPE
andSTATUS
- Sharing Json of event
- Be sure that you have access to Schibsted Artifactory configured in your project or
mavenCentral
- Add
Pulse Unicorn
maven togradle.build
file.
implementation("com.schibsted.pulse:unicorn-android:{$current-version}")
- Initialize Pulse Unicorn in declared
Application
class in your application.
PulseUnicorn.init(this)
# Place initialization at the top of your Application class, before any DI and other parts of code.
To manipulate Pulse Unicorn notification settings from code you can pass PulseUnicornConfig
class to do so.
It will set up your desired settings on each Pulse Unicorn run.
Any settings change made through UI will persistent during PulseUnicorn lifecycle. They will be lost after relaunch / reinstall.
PulseUnicorn.init(
this, PulseUnicornConfig(
enableStickyNotification = true,
stickyNotificationType = StickyNotificationEnum.SIMPLE_NOTIFICATION,
enablePopupNotification = true,
enableInvalidEventNotification = true,
enableFailedEventNotification = false,
notificationChannelIdConfig = PulseUnicornNotificationChannelConfig(
stickyNotificationChannelId = "123123123",
failedPopUpNotificationChannelId = "234234234",
invalidPopUpNotificationChannelId = "345345345"
)
)
)
Default settings for Notification settings
data class PulseUnicornConfig(
var enableStickyNotification: Boolean = true,
var stickyNotificationType: StickyNotificationEnum = StickyNotificationEnum.DETAILED_NOTIFICATION,
var enablePopupNotification: Boolean = true,
var enableInvalidEventNotification: Boolean = true,
var enableFailedEventNotification: Boolean = true,
var notificationChannelIdConfig: PulseUnicornNotificationChannelConfig?
)
- Add
PulseUnicorn.getUnicornInterceptor()
inPulseEnvironment.Builder
viaaddInterceptor
method.
PulseEnvironment.Builder(context, clientId).apply {
addInterceptor(PulseUnicorn.getUnicornInterceptor())
}.build()
You can open Pulse Unicorn from notification card or use dedicated method
PulseUnicorn.openPulseUnicorn(context = this)
To simply check the validation of event Json before sending or during your tests you can
use PulseUnicorn().getUnicornValidator()
. It creates a quick HTTP request to Pulse Console and
returns PulseValidatorResponse
class which holds information about validation results.
success
- bool information about validation
errorsJsonString
- Json String with errors
lifecycleScope.launch(Dispatchers.IO) {
// async
PulseUnicorn.getUnicornValidator().validate(eventJsonString)
?.let { pulseValidator ->
if (pulseValidator.success) {
// event is valid -> send
PulseTrackerProvider().get().track(event)
} else {
// event is not valid -> check errors
Log.d(
"PulseValidator",
pulseValidator.errorsJsonString
?: "Received empty error msg from validator"
)
}
}
}
When, for technical reasons Slack cannot work for you, please make sure to use GitHub issues link instead. We will provide all the necessary answers within the relevant Slack threads (or in Github issue when your case is inserted there). Thank you for your cooperation!