Allay Khalil Allay Khalil - 1 month ago 13
Android Question

How to animate the progress notification icon

I am building the notification progress bar in Service in such a way that is given below :

private NotificationManager mNotifyManager;
private NotificationCompat.Builder mBuilder;

mBuilder =
new NotificationCompat.Builder(DownloadService.this)
.setContentText("Downloading new tools")
.setTicker("Downloading in progress");
Intent targetIntent = new Intent(DownloadService.this, ListClass.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(DownloadService.this);
// Adds the back stack for the Intent (but not the Intent itself)
// Adds the Intent that starts the Activity to the top of the stack
// PendingIntent contentIntent = PendingIntent.getActivity(DownloadService.this, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT);
// mBuilder.setContentIntent(contentIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,


mBuilder.setProgress(100, 0, false);

its working fine , the notification and the progress bar is showing all fine , I wanted the simple progress bar in the notification and it is the simple and I have no problem with that but what I want is given below :

What I want:

I want that My notification Icon should animate like the google play
store app does, it animates its icon to show that download in
progress. I want to do the same. Please tell me by using builder and
notification manager How can I get this , I have seen many tutorial
but they are deprecated.


you can make the animation list as described above in the answer of Rushab patel but there could be problem if you are using the newst api and if you are targetting the new sdk .

so this following line would become outdated and deprecated

Notification notification = new Notification(R.drawable.wheelAnim, null, System.currentTimeMillis());

which is too bad in coding notification , I must suggest you as you have described above that you are using notification builder , thus I would recomend you to directly use this animation list drawable in the notification builder.

from your snippet

mBuilder =
                    new NotificationCompat.Builder(DownloadService.this)
                            .setContentText("Downloading new tools")
                            .setTicker("Downloading in progress");