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!
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).