dodgex edited this page Sep 3, 2014 · 1 revision

Since AndroidAnnotations 3.2


The @WakeLock annotation allows to easily acquire a WakeLock for a method.

Usage example:

@WakeLock(tag = "MyTag", level = WakeLock.Level.FULL_WAKE_LOCK, flags = WakeLock.Flag.ACQUIRE_CAUSES_WAKEUP)
void methodWithWakeLock(String aParam, long anotherParam) {

When the method gets executed, it has a FULL_WAKE_LOCK and due to the ACQUIRE_CAUSES_WAKEUP flag the screen is turned on.


WakeLocks require the android.permission.WAKE_LOCK permission.

<uses-permission android:name="android.permission.WAKE_LOCK" />

Known issues

@WakeLock does not work with @Trace if the method returns a value. For methods with no return value @Trace works as expected.

14/10/2018 The 4.5.1 release is out !

Using AndroidAnnotations


Enjoying AndroidAnnotations

Improving AndroidAnnotations

Extending AndroidAnnotations

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.