I have an ongoing notification for downloading files in the background. I have been successful in creating an multiple simultaneous updating progress bar notifications that are also able to be canceled. This works fine on all tested devices except for some of the more recent Android tablets with Honeycomb.
The effect is now that the original notification message is constantly redisplayed, preventing the user from clicking on the clock to bring up the list of ongoing notifications. As such, no progress bars are even seen. Has anyone been successful in essentially creating progress bar notifications on Honeycomb?
As a side, I also find that my black notification text is no longer readable with the black background of the notification list. Is there a way to set white text for Honeycomb devices?
Note: This has been tested on the Optimus Pad L-06C running Android 3.0.1 and the Motorola Xoom
Below is a the notification creation
// Create new notification for downloading
mNotification = new Notification(R.drawable.owl_icon, getNotificationText(R.string.notification_content_downloading), 0);
mNotification.flags |= (Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT);
// Create custom progress bar view
RemoteViews contentView = new RemoteViews(CourseSyncService.this.getPackageName(), R.layout.notification_downloading);
contentView.setTextViewText(R.id.notificationTitle, mCourseTitle);
contentView.setProgressBar(R.id.notificationProgressBar, 100, 0, false);
contentView.setTextViewText(R.id.notificationPercentage, "0%");
mNotification.contentView = contentView;
// Create pending intent for the notification
Intent notificationIntent = new Intent(CourseSyncService.this, CancelDownloadActivity.class);
notificationIntent.putExtra(CourseSyncService.KEY_USER_ID, mUserId);
notificationIntent.putExtra(CourseSyncService.KEY_COURSE_ID, mCourseId);
notificationIntent.putExtra(CourseSyncService.KEY_COURSE_TITLE, mCourseTitle);
PendingIntent contentIntent = PendingIntent.getActivity(CourseSyncService.this, mCourseId, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
mNotification.contentIntent = contentIntent;
// Launch notification
mNotificationManager.notify(mCourseId, mNotification);
And here is how I update the notification:
// Update the progress bar of the notification view
mNotification.contentView.setProgressBar(R.id.notificationProgressBar, mItemCount, mProgressCount, false);
mNotification.contentView.setTextViewText(R.id.notificationPercentage, String.valueOf(mProgress) + "%");
mNotificationManager.notify(mCourseId, mNotification);