Prevent Activity from closing when device is asleep

XverhelstX

Well-Known Member
Licensed User
Longtime User
Hello,

I have another question,

I have a service that calls(starts) an activity when a timer has ticked.
This works great when my phone isn't asleep, the activity shows and I can work with this activity.
But now, I want that if my phone is asleep, (dimmed), the activity shows too when I unlock my screen.

I tried
phone wakestates
and UserActivity(1000,false)
on Sub Activity_Resume

Here is the log file and see what happens:

** Service (listener) Create **
** Service (listener) Start **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Pause, UserClosed = false **
** Activity (actdownloader) Create, isFirst = true **
PhoneStateListener has been initialized.
** Activity (actdownloader) Resume **
** Activity (actdownloader) Resume **
//*** Here when I press the home button (when my phone is asleep), the actDownloader activity closes and brings me back to my main activity, but I want to see the actDownloader instead. (that has a messagebox.)
** Activity (actdownloader) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **

Sincerely,
Tomas
 
Last edited:
Top