I want that my notification appears on top of all existing notification stack on android wear device. I read a documentation, google says that we have to use method setPriority() for this notification to change notification position within notification statck. I have implemented notification like this:
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.extend(wearableExtender)
.setContentTitle(getSpannableTitle(flightDto.getFlightName()))
.setContentText(getSpannableContentText(flightDto, color, status))
.setPriority(NotificationCompat.PRIORITY_MAX);
But this code doesn't as needed, if calendar notification is on top of all, my notification appears below calendar notification. How to show this notification on top of all notifications?
To show your notification on top of all notifications except setPriotity
you have to add setVibrate
method. Here working code sample:
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.extend(wearableExtender)
.setContentTitle(getSpannableTitle(flightDto.getFlightName()))
.setContentText(getSpannableContentText(flightDto, color, status))
.setPriority(priority)
.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000});
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