I searched many things as like : How to show icon blinking on google map
but according to this i don't find how to blink notification icon blink
i want to blink icon on this
int icon = R.drawable.ic_launcher;
long when = System.currentTimeMillis();
notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, "Hi M rohit", when);
String title = context.getString(R.string.app_name);
Intent notificationIntent = new Intent(context, Home.class);
// set intent so it does not start a new activity
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, title, "Rohit", intent);
//notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.flags |= Notification.FLAG_NO_CLEAR;
notification.defaults = Notification.DEFAULT_ALL;
notificationManager.notify(NOTIFICATION, notification);
i found solution :i created animation file and set that file , thanks i found solution
SET FILE name here:-
int icon = R.drawable.animationfile;
long when = System.currentTimeMillis();
notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, "Your location is tracing", when);
String title = context.getString(R.string.app_name);
Intent notificationIntent = new Intent(context, Home.class);
// set intent so it does not start a new activity
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, title, "Rohit", intent);
//notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.flags |= Notification.FLAG_NO_CLEAR;
notification.defaults = Notification.DEFAULT_ALL;
notificationManager.notify(NOTIFICATION, notification);
i created this file
animationfile.xml :
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/icaon" android:duration="10000" />
<item android:drawable="@drawable/icon" android:duration="10000" />
</animation-list>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With