I'm create a BigPictureStyle
notification with progress bar for a photo upload and it mostly works as it should.
The issue is: if the user collapsed the notification on the notification tray, next time the notification is updated it will expand it again. Is that something I can control? Can I chance the code so the system will keep the notification on the way the user put it?
Below is the code:
NotificationCompat.Builder b = new NotificationCompat.Builder(App.the());
b.setSmallIcon(R.drawable.actionbar_icon);
b.setContentTitle(title);
b.setContentText(content);
b.setTicker(title);
b.setWhen(time);
b.setOnlyAlertOnce(true);
b.setOngoing(true);
b.setProgress(100, progress, false);
NotificationCompat.BigPictureStyle s = new NotificationCompat.BigPictureStyle();
s.setBigContentTitle(title);
s.setSummaryText(content);
s.bigPicture(photo);
b.setStyle(s);
b.setContentIntent( /* sets the activity to open */ );
b.addAction( /* adds the cancel button */ );
NotificationManager mn = ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE));
mn.notify(ONGOING_NOTIFICATION, b.build());
ps.: I also tried keeping the reference to the Notification
object generated by the builder and make changes only to the RemoteView
no success.