This is a common behavior. You shouldn't flood the NotificationManager with frequent updates. You should decide an interval to update, like twice every second.
For example,
long startTime;
long elapsedTime = 0L;
if (elapsedTime > 500) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
mBuilder.setProgress(100, (int) newValue, false);
mNotifyManager.notify(notificationID, mBuilder.build());
startTime = System.currentTimeMillis();
elapsedTime = 0;
}
});
Log.d("Andrognito", newValue + "Progress");
}
else
elapsedTime = new Date().getTime() - startTime;
This works perfectly for me and doesn't freeze the notifications too. Hope this helps!
This is a common behavior. You shouldn't flood the NotificationManager with frequent updates. You should decide an interval to update, like twice every second.
For example,
long startTime;
long elapsedTime = 0L;
if (elapsedTime > 500) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
mBuilder.setProgress(100, (int) newValue, false);
mNotifyManager.notify(notificationID, mBuilder.build());
startTime = System.currentTimeMillis();
elapsedTime = 0;
}
});
Log.d("Andrognito", newValue + "Progress");
}
else
elapsedTime = new Date().getTime() - startTime;
This works perfectly for me and doesn't freeze the notifications too.