I want to create notification like the pop-up notification used in WhatsApp application for android devices.
How can i do it? Since i am a new user I cannot upload the screen shot
please refer this link : http://cdn6.staztic.com/cdn/screenshot/appsdroidnotifythemeicecreamsandwich-1-1.jpg
for the screen shot image and help me :)
A popup notification is a message that appears on your users' browser or desktop. They're designed to grab your audience's attention and engage them in some way.
The terms pop-up notification, toast, passive pop-up, snackbar, desktop notification, notification bubble, or simply notification all refer to a graphical control element that communicates certain events to the user without forcing them to react to this notification immediately, unlike conventional pop-up windows.
Make sure Do not disturb is turned off or you have allowed WhatsApp notifications in priority mode in your phone's Settings app > Sound > Do not disturb. Make sure all of WhatsApp's permissions are granted in your phone's Settings app > Apps > WhatsApp > Permissions.
They're called 'heads-up' notifications. This page has a nice explanation.
To summarize, set the priority to High (or Max).
Here is an example in my code:
public static void notify(Context context, int id, int titleResId,
int textResId, PendingIntent intent) {
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
String title = context.getString(titleResId);
String text = context.getString(textResId);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.notification)
.setContentTitle(title)
.setContentText(text)
.setDefaults(Notification.DEFAULT_ALL)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setAutoCancel(true)
.setWhen(System.currentTimeMillis())
.setTicker(title)
.setContentIntent(intent);
notificationManager.notify(id, builder.build());
}
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