One of my Activities starts an AsyncTask
and adds an ongoing notification to the notification area. This notification receives updates from within the AsyncTask
.
I did this so the users are able to leave the Activity with the Home button and still receive progress updates during a long running operation.
Clicking the notification should return the user to this activity. The problem is that no matter what, it seems that the old activity is never used again, but instanciated new (while the AsyncTask
still runs). The onCreate
method of this activity gets called every time the notification gets clicked.
I tried using the FLAG_NO_CREATE
and FLAG_UPDATE_CURRENT
options, but it doesn't make any difference.
What is the correct way to handle this situation? I'm developing for API level 4.