-
- All Implemented Interfaces:
-
io.getstream.android.push.permissions.NotificationPermissionHandler,io.getstream.video.android.core.notifications.NotificationHandler,io.getstream.video.android.core.notifications.StreamNotificationDispatcher,io.getstream.video.android.core.notifications.handlers.StreamNotificationHandler,io.getstream.video.android.core.notifications.handlers.StreamNotificationHandlerWithPayload,io.getstream.video.android.core.notifications.handlers.StreamNotificationProvider,io.getstream.video.android.core.notifications.handlers.StreamNotificationProviderWithPayload,io.getstream.video.android.core.notifications.handlers.StreamNotificationUpdatesProvider,io.getstream.video.android.core.notifications.handlers.StreamSettingUpCallNotificationProvider,io.getstream.video.android.core.notifications.medianotifications.MediaNotificationHandler
public class CompatibilityStreamNotificationHandler extends StreamDefaultNotificationHandler implements NotificationHandler
Compatibility notification handler that bridges the new notification system with the legacy notification handler behavior.
This class allows applications that previously relied on the old notification handler APIs to continue working while adopting the new notification interception mechanism.
notificationHandler = CompatibilityStreamNotificationHandler( context.app, initialNotificationBuilderInterceptor = object : StreamNotificationBuilderInterceptors() { override fun onBuildIncomingCallNotification( builder: NotificationCompat.Builder, fullScreenPendingIntent: PendingIntent, acceptCallPendingIntent: PendingIntent, rejectCallPendingIntent: PendingIntent, callerName: String?, shouldHaveContentIntent: Boolean ): NotificationCompat.Builder { builder.setContentTitle("My new and shiny incoming call") builder.setContentText( "This is my new content text that I've changed!!!" ) return builder } }, updateNotificationBuilderInterceptor = object : StreamNotificationUpdateInterceptors() { private suspend fun loadBitmapFromUrl(url: String): Bitmap = withContext(Dispatchers.IO) { URL(url).openStream().use { BitmapFactory.decodeStream(it) } } override suspend fun onUpdateIncomingCallNotification( builder: NotificationCompat.Builder, callDisplayName: String?, call: Call ): NotificationCompat.Builder { // For demonstration purposes, a delay can be added here. // delay(4_000) val userImageUrl = "MyImageURL" val bitmap = loadBitmapFromUrl(userImageUrl) builder.setContentText("My new notification with my image!!") builder.setLargeIcon(bitmap) return builder } } )
-
-
Constructor Summary
Constructors Constructor Description CompatibilityStreamNotificationHandler(Application application, NotificationPermissionHandler notificationPermissionHandler, NotificationManagerCompat notificationManager, StreamIntentResolver intentResolver, Boolean hideRingingNotificationInForeground, StreamNotificationBuilderInterceptors initialNotificationBuilderInterceptor, StreamNotificationUpdateInterceptors updateNotificationBuilderInterceptor, StreamMediaSessionController mediaSessionController, MediaSessionCompat.Callback mediaSessionCallback, StreamNotificationChannels notificationChannels)
-
Method Summary
Modifier and Type Method Description UnitgetNotificationUpdates(CoroutineScope coroutineScope, Call call, User localUser, Function1<Notification, Unit> onUpdate)Get subsequent updates to notifications. NotificationDispatchergetStreamNotificationDispatcher()NotificationCompat.BuildercreateMinimalMediaStyleNotification(StreamCallId callId, MediaNotificationConfig mediaNotificationConfig, Integer remoteParticipantCount)MediaNotificationConfiggetMediaNotificationConfig()-
Methods inherited from class io.getstream.video.android.core.notifications.NotificationHandler
getIncomingCallNotification, getMissedCallNotification, getOngoingCallNotification, getRingingCallNotification, getSettingUpCallNotification, getSettingUpCallNotification, onCallNotificationUpdate, onLiveCall, onMissedCall, onNotification, onPermissionDenied, onPermissionGranted, onPermissionRationale, onPermissionRequested, onRingingCall, updateIncomingCallNotification, updateOngoingCallNotification, updateOutgoingCallNotification -
Methods inherited from class io.getstream.video.android.core.notifications.handlers.StreamNotificationHandler
onLiveCall, onMissedCall, onNotification, onRingingCall -
Methods inherited from class io.getstream.video.android.core.notifications.handlers.StreamNotificationProvider
getIncomingCallNotification, getMissedCallNotification, getOngoingCallNotification, getRingingCallNotification -
Methods inherited from class io.getstream.video.android.core.notifications.handlers.CompatibilityStreamNotificationHandler
getNotificationOwnedIncomingCallNotification -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CompatibilityStreamNotificationHandler
CompatibilityStreamNotificationHandler(Application application, NotificationPermissionHandler notificationPermissionHandler, NotificationManagerCompat notificationManager, StreamIntentResolver intentResolver, Boolean hideRingingNotificationInForeground, StreamNotificationBuilderInterceptors initialNotificationBuilderInterceptor, StreamNotificationUpdateInterceptors updateNotificationBuilderInterceptor, StreamMediaSessionController mediaSessionController, MediaSessionCompat.Callback mediaSessionCallback, StreamNotificationChannels notificationChannels)
-
-
Method Detail
-
getNotificationUpdates
@Deprecated(message = Deprecated method. Use the onCallNotificationUpdate method instead., level = DeprecationLevel.ERROR, replaceWith = @ReplaceWith(imports = {}, expression = onCallNotificationUpdate(call))) Unit getNotificationUpdates(CoroutineScope coroutineScope, Call call, User localUser, Function1<Notification, Unit> onUpdate)
Get subsequent updates to notifications. Initially, notifications are posted by one of the other methods, and then this method can be used to re-post them with updated content.
- Parameters:
coroutineScope- Coroutine scope used for the updates.call- The Stream call object.localUser- The local Stream user.onUpdate- Callback to be called when the notification is updated.
-
getStreamNotificationDispatcher
NotificationDispatcher getStreamNotificationDispatcher()
-
createMinimalMediaStyleNotification
@Deprecated(message = This interface is deprecated. Use the notification interceptors instead., level = DeprecationLevel.ERROR) NotificationCompat.Builder createMinimalMediaStyleNotification(StreamCallId callId, MediaNotificationConfig mediaNotificationConfig, Integer remoteParticipantCount)
-
getMediaNotificationConfig
@Deprecated(message = This interface is deprecated. Use the notification interceptors instead., level = DeprecationLevel.ERROR) MediaNotificationConfig getMediaNotificationConfig()
-
-
-
-