This is the code I'm using
http://pastebin.com/3bMCKURu
The problem is that after some time (File gets more weight) notification bar get slower to pulldown, and finally it just freezes!
This is the code I'm using
http://pastebin.com/3bMCKURu
The problem is that after some time (File gets more weight) notification bar get slower to pulldown, and finally it just freezes!
I ran into a similar problem, it would seem that RemoteViews have a memory leak and shouldn't be reused so much.
Look at these threads:
android memory leak in notification service
http://code.google.com/p/android/issues/detail?id=13941
http://groups.google.com/group/android-developers/browse_thread/thread/667343a171e51463#
Good luck
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!
Your notifications are too frequent. thats why it freezes. make them update in bigger intervals. Ok is once in every second or 2 seconds.
This solution worked for me (ugly but working):
private static int mPercentDownloaded;
@Override
protected Void doInBackground(String... params) {
...
mPercentDownloaded = (int) ((total * 100) / lenghtOfFile);
long currentDownloadTicks = System.currentTimeMillis();
if (currentDownloadTicks > mDownloadTicks + 1000) {
publishProgress(mPercentDownloaded);
mDownloadTicks = currentDownloadTicks;
}
...
}