What Should I Replace Screen_dim_wake_lock With?
I am currently utilizing the below referenced code for a wake lock on an alarm notification activity. However, SCREEN_DIM_LOCK has been depreciated. So, what should I be replacing
Solution 1:
Android Developer documentation specifies that SCREEN_DIM_WAKE_LOCK
should be replaced with FLAG_KEEP_SCREEN_ON
. After doing a bit of digging, I turned up this...
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
It should be placed in the onCreate()
method.
Solution 2:
It can be replaced for FLAG_KEEP_SCREEN_ON
, as the javadoc says, but this will prevent the screen from dimming - it will remain bright.
This API should not have been deprecated - it is still needed in some cases, such as the "dim" case.
See also this.
Solution 3:
Just use
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
In place of
PowerManager.SCREEN_DIM_WAKE_LOCK
Post a Comment for "What Should I Replace Screen_dim_wake_lock With?"