Thanks, Justin. So if I implement a partial wake lock, when the user
hits the red power button the screen should turn off but the CPU
should remain on...correct? Where should the partial wake lock be
implemented? In the activity or in a service?
What I'm trying to accomplish is to leave the sensors running when the
user hits the power button. I'm really just trying to understand how
the wake lock works right now so forgive me while I ignore your
battery warning. I have a SensorListener service set up and I have
tried to set up the wake lock like this:
@Override
public void onCreate() {
mSensorManager = (SensorManager) getSystemService
(SENSOR_SERVICE);
PowerManager pm = (PowerManager)getSystemService
(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
MySensorListener.class.getName());
mWakeLock.acquire();
}
But when the power button is pushed, the sensor manager no longer
provides a reading. Obviously, I have something wrong. Do you have
any info on how a wake lock should be implemented?
Thanks!
On Feb 2, 2:30 pm, "Justin (Google Employee)" <[email protected]> wrote:
> It doesn't. Music player holds a partial wake lock which keeps the CPU
> running when the screen is off. It is important to note: (device
> sleep) != (screen off). Holding a partial wake lock has a negative
> impact on battery life. Depending on the process holding the wake lock
> and the other processes running on the phone, the wake lock can have a
> detrimental impact on battery life.
>
> In the case of music player, it is apparent that the users wishes to
> trade battery life for a purpose (playing music). Use wake locks
> *very* carefully.
>
> Cheers,
> Justin
> Android Team @ Google
>
> On Jan 29, 12:23 pm, Chad <[email protected]> wrote:
>
> > How is it that the Music player (MediaPlayer) is able to continue
> > playing music while the phone is insleepmode?
>
> > Justin (Google Employee) wrote:
> > > This is not possible. Insleepmodethe G1's primary CPU is turned
> > > off. Maintaining theWiFiconnectionrequires use of the primary CPU.
> > > ThereforesleepmodeandWiFiare incompatible.
>
> > > Cheers,
> > > Justin
> > > Android Team @ Google
>
> > > On Jan 28, 6:41 am, Thomas Iverson <[email protected]> wrote:
> > > > hi all , i found g1 will automatically turn off thewificonnectioninsleep
> > > >mode, maybe it's for battery saving or something what , but , i want to
> > > >keepwificonnectionalive
> > > > i googled a lot and still don't get any useful solution , any help ?
> > > > thanks
> > > > a lot !
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---