Hot questions for Using Glide in android notifications

Top 10 Java Open Source / Glide / android notifications


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(,"Hello World!");

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, CHANNEL_ID)
            .setStyle(new NotificationCompat.DecoratedCustomViewStyle())

    final Notification notification =;


    notificationTarget = new 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


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?


Android doesn't support GIF and Videos in notification because notification is built using RemoteViews and RemoteViews doesn't support GIF or Videos.

Also, Glide maintainer answered a similar question here. I am quoting the answer.

It doesn't look like RemoteViews supports setting a Drawable?

If there's a way to set an animated drawable in a notification in general, you can probably find a way to do it with a custom Target in Glide.


I'm creating a simple notification with playback buttons for my audio player. But I have trouble setting the bitmap image for .setLargeIcon(). I'm trying to set it using glide. The thing is this image changes as user skips to next song, so this is pretty much a dynamic view. The image sometimes appears (for a split second), when I change the song or pause it. I'll be glad if you guys could help me!


Build notification:

    private void buildNotifications(PlaybackStatus playbackStatus){



    int notificationAction = android.R.drawable.ic_media_pause;//needs to be initialized
    PendingIntent play_pauseAction = null;

    //Build a new notification according to the current state of the MediaPlayer
    if (playbackStatus == PlaybackStatus.PLAYING) {
        notificationAction = android.R.drawable.ic_media_pause;
        //create the pause action
        play_pauseAction = playbackAction(1);
    } else if (playbackStatus == PlaybackStatus.PAUSED) {
        notificationAction = android.R.drawable.ic_media_play;
        //create the play action
        play_pauseAction = playbackAction(0);

   final NotificationCompat.Builder notiB = new NotificationCompat.Builder(this,CHANNEL_ID);
    notiB.setStyle(new MediaStyle()
    Glide.with(this).asBitmap().load(songInfoModelService.getAlbumIDArtwork()).into(new SimpleTarget<Bitmap>() {
        public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {

    notiB.addAction(android.R.drawable.ic_media_previous, "previous", playbackAction(3));
    notiB.addAction(notificationAction, "pause", play_pauseAction);
    notiB.addAction(android.R.drawable.ic_media_next, "next", playbackAction(2));

    notification =;



This will not work synchronously . Glide.with(this).asBitmap().load() is an Asynchronous request so it will execute on separate thread regardless of your current thread . So in this case notiB.setLargeIcon(resource) never will get called synchronously.

Solution can be Show the notification inside onResourceReady(). Once you download the Bitmap then build the Notification .