Android notification progressbar freezing

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!

Upvotes: 4

Views: 3533

Answers (2)

LM.Croisez
LM.Croisez

Reputation: 504

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;
        }
...
}

Upvotes: 3

DArkO
DArkO

Reputation: 16110

Your notifications are too frequent. thats why it freezes. make them update in bigger intervals. Ok is once in every second or 2 seconds.

Upvotes: 3

Related Questions