I have been trying to show a .gif image inside my custom notification using Glide library. I am only able to show static image on the notification panel.
RemoteViews collapsedView = new RemoteViews(getPackageName(), R.layout.notification_collapsed);
RemoteViews expandedView = new RemoteViews(getPackageName(), R.layout.notification_expanded);
collapsedView.setTextViewText(R.id.text_view_collapsed_1,"Hello World!");
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_launcher_background)
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(collapsedView)
.setCustomBigContentView(expandedView);
final Notification notification = mBuilder.build();
notificationManager.notify(NOTIFICATION_ID,notification);
notificationTarget = new NotificationTarget(
getApplicationContext(),
R.id.image_view_expanded,
expandedView,
notification,
NOTIFICATION_ID
);
Glide.with(MainActivity.this)
.asBitmap()
.load(R.drawable.giphy)
.into(notificationTarget);
The drawable is a .gif file. When the notification pops up it shows a static image as I am using .asBitmap(). I tried using
Glide.with(MainActivity.this)
.asGif()
.load(R.drawable.giphy)
.into(notificationTarget);
but i am getting an error "Cannot resolve method 'into(NotificationTarget)'". I have looked around for solutions but i was unable to find one. So how can I show a GIF file with glide in android's notification panel? Is it possible?