更改“脉冲通知灯"/Android 上的轨迹球灯设置(仅限 Nexus One?) [英] Change "Pulse notification light" / trackball light setting on Android (Nexus One only?)
问题描述
在 Nexus One 上(至少在 2.1-update1 中,我认为在 2.1 中),在 Sound & 下有一个设置.显示:脉冲通知灯".这似乎没有出现在2.1 with Google APIs"模拟器图像上.我还没有检查过任何其他设备.
脉冲通知灯:脉冲轨迹球灯反复显示新通知 http://chris.boyle.name/images/20100206-pulse-trackball.png
我想在没有用户交互的情况下以编程方式进行设置,以便制作区域设置插件,这样当我在办公桌前醒来时设备可以吸引我的注意力,而不会在凌晨 4 点有人向我发送垃圾邮件时让它泛光照明房间.还挺亮的.
我在 android.provider.Settings 中没有看到它.系统在此屏幕上显示了许多其他内容,因此我查看了平台源代码.NotificationManagerService 中有一些相关的部分,在 enqueueNotificationWithTag 和 updateLightsLocked.这进入 HardwareService 这似乎远远超出了关心用户设置的程度.我不知道在何处实施此设置,也不知道我会如何影响它.
我完全希望答案是没有用于此的 API"(可能与它特定于 Nexus One 有关),并且我能做的最好的事情是安排(使用语言环境或其他东西)ACTION_DISPLAY_SETTINGS 提醒我手动设置框,这会很糟糕.我希望我错过了什么,或者 aGoogle 员工正在阅读此内容,能否告诉我计划将其添加到 API 中?
我知道我会因为使用未记录的 API(或者更确切地说,未记录的系统设置名称)而痛苦地死去,但这里是神奇的线:
>
android.provider.Settings.System.putInt(context.getContentResolver(),notification_light_pulse",打开?1 : 0);
在我自己的设备上使用 sqlite3
发现的.
这是一个方便的 Locale 插件中的解决方案:http://chris.boyle.name/projects/ptlp
On the Nexus One (at least in 2.1-update1, and I think in 2.1), there is a setting under Sound & Display: "Pulse notification light". This doesn't seem to be present on the "2.1 with Google APIs" emulator image. I've not yet checked any other devices.
I want to set this programmatically without user interaction, in order to make a Locale plugin, so the device can grab my attention when I'm awake at my desk, without having it floodlighting the room when someone spams me at 4am. It's quite bright.
I didn't see it in android.provider.Settings.System where many other things on this screen live, so I had a look in the platform source. There are some relevant parts in NotificationManagerService, in enqueueNotificationWithTag and updateLightsLocked. That goes off into HardwareService which seems well past the point of caring about user settings. I've no idea where this setting is implemented or how I might influence it.
I fully expect the answer to be "there is no API for this" (perhaps related to it being Nexus One specific), and that the best I can do is to schedule (using Locale or something else) an Intent of ACTION_DISPLAY_SETTINGS to remind me to set the box manually, which would suck. I'm hoping that I've missed something, or that a Googler is reading this and can tell me that this is planned for addition to the API?
I know I'm going to die painfully for using an undocumented API (or rather, undocumented system setting name), but here is the magic line:
android.provider.Settings.System.putInt(context.getContentResolver(),
"notification_light_pulse", on ? 1 : 0);
Found using sqlite3
on my own device.
Here is this solution in a convenient Locale plugin: http://chris.boyle.name/projects/ptlp
这篇关于更改“脉冲通知灯"/Android 上的轨迹球灯设置(仅限 Nexus One?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!