I have a service which detects certain system events, like certain hour of the day. I would like my service to (when criteria is met) to dim user screen.
So far, looking though internet and StackOverflow i found a plenty of solutions relying on "getWindow()" which means my app must have a running foreground activity in order to achieve this.
If i just have a service which should put a system-wide screen brightness to, say, 30%, what needs to be done? I don't think it's very similar to changing brightness "locally" (just for my own app).
My idea was obtaining a "window" of current foreground app, but i'm not very sure if that's even possible :\\
Can someone give me some hint or help please, all my searches ended with "you need to call "getWindow()" of your own app"?
I believe it is
System.putInt(contentResolver, System.SCREEN_BRIGHTNESS, brightness)
But you also need permissions Pre api 23
android.permission.WRITE_SETTINGS
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.