I have a long running Async Task that sends some data to my server and then stops. The whole process may involve a few requests and response. I have to read data from database, send it and handle the response and update my database accordingly. I am using content providers to read and update data from database.
Now to use the Content Provider, I have to call the getContentResolver()
method on context. So I am wondering whether I have to use getApplicationContext
or just pass the Activity.this
to my methods.
I saw a few posts like this explaining the difference between the two and in most of them they advice us to not use getApplicationContext
if possible. Although I do not want my AsyncTask
to lose the context from Activity.this
when the Activity
is destroyed or when orientation changes. So I am wondering if I can use getApplicationContext
in my case or will using Activity.this
fit my requirement.