简体   繁体   English

Android Wear - 以编程方式启用/禁用环境模式

[英]Android Wear - Enable / Disable Ambient mode Programmatically

I have in the past developed some small Android Apps, and have recently gotten an LG G Watch, and absolutely love it.我过去曾开发过一些小的 Android 应用程序,最近又买了一个 LG G Watch,我非常喜欢它。

Right now, the only issue with the device is that it lasts about a day and a half in ambient mode.目前,该设备的唯一问题是它在环境模式下可以持续大约一天半。

What I am looking to be able to do is through software, enable and disable the ambient mode on the device.我希望能够做的是通过软件,启用和禁用设备上的环境模式。 In doing this, we will be able to turn it off at specific times, ie at night.这样做时,我们将能够在特定时间关闭它,即在晚上。

The advantage of being able to do this is both save the display, and by turning ambient mode off at night, I only need to charge the device every other day, but it is just an inconvenience to enable / disable every day.能够做到这一点的好处是既可以节省显示屏,又可以在夜间关闭环境模式,我只需要每隔一天给设备充电一次,但每天启用/禁用只是不便。

I have the Java / Android experience to build the app, but the question I have is essentially the whole thing:我有构建应用程序的 Java/Android 经验,但我的问题基本上是整个事情:

How can I, in code, enable and disable ambient mode?如何在代码中启用和禁用环境模式?

Is this possible?这可能吗? I spent some time googling, and been unable to find an answer.我花了一些时间谷歌搜索,但无法找到答案。 Has anyone used the wearable API?有人用过可穿戴API吗? And is there anything in it that would allow something like this?里面有什么东西可以允许这样的事情吗?

It is not possible to disable ambient mode programatically.无法以编程方式禁用环境模式。 However, you don't need to do what you are describing.但是,您无需执行所描述的操作。 The device detects that is not worn and after 30 minutes it will turn the screen off completely, including turning off ambient mode.设备检测到未佩戴,30 分钟后将完全关闭屏幕,包括关闭环境模式。

如果您是 AOSP 程序员,请修改AmbientService以从AmbientDream调用finish() ,如果您是应用程序程序员,抱歉没有您想要的 API。

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

相关问题 在环境模式下更频繁地更新不起作用-Android Wear / WearOS - Updating more Frequently in Ambient Mode not working - Android Wear / WearOS 以编程方式启用/禁用沉浸模式 - Programmatically enable/disable Immersive Mode 如何在 Android 上以编程方式启用/禁用热点或网络共享模式? - How do I enable/disable hotspot or tethering mode programmatically on Android? 如何在android中以编程方式启用或禁用隐身键盘? - How to enable or disable incognito keyboard programmatically in android? 阻止Android Watch Batery环境模式 - Block android watch batery ambient mode 如何在android中以编程方式启用/禁用gps和移动数据? - How to enable/disable gps and mobile data in android programmatically? Android:如何以编程方式启用/禁用 Wifi 或 Internet 连接 - Android: How to Enable/Disable Wifi or Internet Connection Programmatically 如何在 android studio 上以编程方式检查自动启动权限是启用还是禁用 - how to check Programmatically AutoStart Permission is Enable or disable on android studio 如何以编程方式禁用“省电”模式。 (Android) - How to disable “Power saving” mode programmatically. (Android) 能够以编程方式访问Android Wear上的NFC设置 - Ability to access NFC settings on Android Wear programmatically
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM