I figured out that executing phone lock on app startup gets my initial AsyncTask out of step because it doesn’t call onStart (where I attach and detach the Activity to the task) after unlock. Obviously phone lock mode means something different to any app than using Home or Back button, because in the latter ones, my app can deal with them. It seems that the locking/unlocking mode doesn’t close the app, but it doesn’t keep it running too, so in my opinion this is some kind of unexpected behavior which is very stupid because I “lose” my AsyncTask and my app is not getting initialized properly.
How can I execute some logic on phone unlocking, because the unlock/lock doesn’t seem to call any lifecycle methods? And do I have to distinguish between lock on/off and screen on/off?
I found a solution which works for me. Due to Squonks comment I saw that onResume will be executed. I was able to adapt the logic of my app so my app can handle the AsyncTask (attaching/detaching + showing progress dialog + initialization) in onResume now.