Not using a WakeLock so why does the device stay awake?

by westmeadboy » Tue, 13 Apr 2010 19:56:17 GMT


Sponsored Links
 Hmmm, so in that case, why does the device not sleep after the user
has used the power button to turn off the screen? Or do you mean that
the activity is still considered in the foreground even after that?






--



Not using a WakeLock so why does the device stay awake?

by westmeadboy » Wed, 14 Apr 2010 15:19:10 GMT


 So I tried this:

Start service
Press Home
Start some other 3rd party app (so that activity is in the foreground)
Press power button to blank screen

A few minutes later, I press the power button to unblank the screen
and discover the service finished successfully.

This means the phone never went to sleep...

Any ideas why?






--


Sponsored Links


Not using a WakeLock so why does the device stay awake?

by THill » Fri, 23 Apr 2010 01:52:44 GMT


 I've seen similar behavior as the OP.

I have a simple activity that starts a timer in onCreate, logging a
message every second.  No wake lock is requested, so after the time
indicated in setting, the device sleeps (allowed to dim, then sleep
naturally, not with power button press).  After letting it sit like
that for a few minutes, I plug it in via USB & check the logs, where I
can see the timer continued running through the sleep.

If I then do 'adb shell dumpsys power', the only wake locks shown are:
mLocks.size=2:
  SCREEN_DIM_WAKE_LOCK           'StayOnWhilePluggedIn Screen Dim'
activated (minState=1)
  PARTIAL_WAKE_LOCK              'StayOnWhilePluggedIn Partial'
activated (minState=0)

which makes sense since the device is now plugged in via USB.

Is this expected behavior?  Seems to go against the idea that all
threads are suspended during the sleep...

Thanks for any clarification,
Tim






--



Other Threads

1. How to create an asynchronous communication layer

Hello,

I want to create a communication layer in android. The layer will
communicate with server asynchronously. Multiple activities should be
able to call methods of the communication layer. The layer will get
messages from the server (it is not important for the scope of this
question how) and should be able to tell activities to do some work
based on these messages.

How should I implement this? Should I do this using android Service?


The main questions that I need to answer are:
How can activities access the layer?
How can the layer access activities?
How can i make the communication layer live for the lifetime of the
application?


Thank you for any help
Palo

-- 

2. Repeating AsyncTasks t

I'm not sure if I'm going the right way about this.. but..

I have both username and password fields, as well as a login button.
When the login button is clicked I grab both the username and password
and attempt an online login. The authentication happens inside of an
AsyncTask so I can display a ProgressDialog. If the users attempt to
login failed, they should have another chance. But of course I'm
unable to repeat an already Finished AsyncTask.

What would be a canonical work around for this? I'm under the
impression resetting a variable which contains an instance of the task
and re-applying it would be a 'bad thing'.

Regards,
Lee

-- 

3. Merge Images with Transparency

4. Android market place crashes on receiving intent for an application that doesn't exists in marketplace

5. Installation script

6. Music app crashing on my Ecalir 2.1 emulator

7. Best Practice question: Passing an array to a View