I need help to do something. I try to display a notification into the android statusbar.
It will inform the user that a synchronization with the server is in progress.
Now, I use this code and it works fine :
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(android.R.drawable.stat_notify_sync).setWhen(System.currentTimeMillis())
.setAutoCancel(false).setOngoing(true);
NotificationManager nm = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notif = builder.getNotification();
nm.notify(1, notif);
The only one problem is that a view is created when the user expand the statusbar. What I want to do is only display a small icon on the top of the status bar, without the contentview.
Anyone know how to do that ? Thanks in advance!
To customize it, first pull down the slider bar from the top of the screen. Next, tap on the three vertical dots in the top right corner. Now click on Status bar. You're in.
Status bar (or notification bar) is an interface element at the top of the screen on Android devices that displays the notification icons, minimized notifications, battery information, device time, and other system status details.
By default, if you see a notification icon in the notification bar that you want to see more about, swipe down once from the top of your screen to expand your notifications.
This is not possible.
The rationale is this: if the user looks at the status bar and sees an icon, she should have some way of figuring out what that icon means. Therefore there must be a row in the notification panel corresponding to each icon.
I suggest creating a notification that explains, just as you have done in your question, that a synchronization is in progress; this is a great opportunity to indicate which app is currently syncing (so if there's some kind of problem or the sync is taking forever the user knows which app needs attention).
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