简体   繁体   English

更改服务中的系统亮度

[英]Alter system brightness within a service

Although I am able to set the system brightness within an Activity successfully, it would seem that services don't fair too well.尽管我能够成功地在 Activity 中设置系统亮度,但服务似乎不太公平。 The brightness setting IS being set (I read it back and printed it to Logcat), but the brightness itself is not changing.正在设置亮度设置(我将其读回并将其打印到 Logcat),但亮度本身并没有改变。 My issue is very similar to this one:我的问题与这个非常相似:

Control screen brightness in android using " Background Service" 使用“后台服务”控制 android 中的屏幕亮度

However, I'm not happy with the crude nature of the solution offered in that link.但是,我对该链接中提供的解决方案的原始性质不满意。 Is there a better way?有没有更好的办法?

Thanks.谢谢。

Got a solution: GeekYouUp's method here works: Update Display Brightness on Android after changing it programmatically得到了解决方案:GeekYouUp 的方法在这里有效: 在以编程方式更改 Android 后更新显示亮度

You need to make sure you finish() the activity with a small delay, that was my main issue.你需要确保你完成()活动有一点延迟,这是我的主要问题。 Sure it's not 'clean' to have a transparent activity pop up, but what can you do?当然,弹出一个透明的活动并不“干净”,但你能做什么? I'm quite sure that there's no other way.我很确定没有其他办法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM