简体   繁体   中英

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.

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:

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? 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.

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

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.

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