Password Late

This is the code I'm using.

http://pastebin.com/3bMCKURu

The problem is that after a while (the file gets more weight) the notification bar becomes slower for the drop-down list, and finally it just freezes!

+3
source share
4 answers

I am having a similar problem, it looks like RemoteViews has a memory leak and should not be reused.

Take a 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.

+4
source

. . . - 2 .

+2

This is the usual behavior. You should not flood NotificationManager with frequent updates. You must select the interval for updating, for example, twice per second.

For instance,

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 great for me and does not delay notifications. Hope this helps!

+1
source

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;
        }
...
}
+1
source

All Articles