问题
For experiment/user study purpose, I need to keep my screen on for few minutes.
I have follow the guide from http://developer.android.com/training/wearables/apps/always-on.html and it works partially for my purpose.
The code allows my screen always on BUT it will enter ambient mode after few seconds. I DO NOT want ambient mode.
My trick is I commented out onEnterAmbient(), onUpdateAmbient() and onExitAmbient().
So that my screen drawing is still the same color (not changing to black & white).
HOWEVER the screen is DIMMED darker when entering ambient mode.
I don't want the DIMMED effect, I need to keep my screen as bright as possible for the duration of my user study.
Anyone has any clue?
回答1:
You may try
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
in your activity's onCreate()
or use
android:keepScreenOn="true"
in your activity's layout. See this training material for details.
来源:https://stackoverflow.com/questions/34971530/always-on-without-ambient-mode-or-do-not-dim-when-enter-ambient