configureTripNotification

Configures a custom trip notification provider for dynamic notification customization.

This method allows your app to dynamically configure trip notifications using Android's NotificationChannel and Notification objects. The provider will be called each time a trip recording starts, enabling you to customize notifications based on your app's current state, user preferences, or business logic.

Usage Example

Fairmatic.configureTripNotification {
val channel = NotificationChannel(
"trip_channel",
"Trip Notifications",
NotificationManager.IMPORTANCE_LOW
)
val notification = NotificationCompat.Builder(context, "trip_channel")
.setContentTitle("Trip in progress")
.setContentText("Your trip is being recorded")
.setSmallIcon(R.drawable.ic_car)
.build()

TripNotificationContainer(channel, notification, NOTIFICATION_ID)
}

Important Notes

  • Call this method on every app launch if you want to customize notifications

  • The provider will only be invoked when a trip actually starts

  • If the provider returns null, the default notification from setup method will be used as fallback

  • Ensure your NotificationChannel is properly configured for the target Android version

Parameters

notificationProvider

Functional interface that provides TripNotificationContainer instances when invoked by the SDK during trip start

See also