Android
android.os
public class

android.os.PowerManager.WakeLock

java.lang.Object
android.os.PowerManager.WakeLock

Class lets you say that you need to have the device on.

Call release when you are done and don't need the lock anymore.

Summary

Public Methods

          void  acquire()
Makes sure the device is on at the level you asked when you created the wake lock.
          void  acquire(long timeout)
Makes sure the device is on at the level you asked when you created the wake lock.
          boolean  isHeld()
          void  release()
Release your claim to the CPU or screen being on.
          void  setReferenceCounted(boolean value)
Sets whether this WakeLock is ref counted.
          String  toString()
Returns a string containing a concise, human-readable description of the receiver.

Protected Methods

          void  finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
Methods inherited from class java.lang.Object

Details

Public Methods

public void acquire()

Makes sure the device is on at the level you asked when you created the wake lock.

public void acquire(long timeout)

Makes sure the device is on at the level you asked when you created the wake lock. The lock will be released after the given timeout.

Parameters

timeout Release the lock after the give timeout in milliseconds.

public boolean isHeld()

public void release()

Release your claim to the CPU or screen being on.

It may turn off shortly after you release it, or it may not if there are other wake locks held.

public void setReferenceCounted(boolean value)

Sets whether this WakeLock is ref counted.

Parameters

value true for ref counted, false for not ref counted.

public String toString()

Returns a string containing a concise, human-readable description of the receiver.

Returns

  • String a printable representation for the receiver.

Protected Methods

protected void finalize()

Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Throws

Throwable
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56