简体   繁体   English

Android Wear检测“静音”

[英]Android Wear detect “Mute”

How does an application check in on "Mute" status of an Android Wear device? 应用程序如何签入Android Wear设备的“静音”状态?

All volumes seem t be 0 no matter what. 无论如何,所有体积似乎都不为0。

Log.d("VOLUME - STREAM_SYSTEM", Integer.toString(audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM)));
Log.d("VOLUME - STREAM_NOTIFICATION", Integer.toString(audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION)));
Log.d("VOLUME - STREAM_RING", Integer.toString(audioManager.getStreamVolume(AudioManager.STREAM_RING)));

gives me 给我

D/VOLUME - STREAM_SYSTEM(32598): 0
D/VOLUME - STREAM_NOTIFICATION(32598): 0
D/VOLUME - STREAM_RING(32598): 0

Unfortunately Google has not seen fit to expose this to us lowly developers at this time as far as I can tell. 不幸的是,据我所知,目前Google并不适合向我们这个低级的开发者开放。

Thanks to the research of a friend of mine, Ive found this code. 感谢我的一个朋友的研究,Ive找到了这段代码。

public static boolean inZenMode(Context paramContext)
  {
    return paramContext.getSharedPreferences("home_preferences", 0).getBoolean("in_zen_mode", false);
  }

Zen mode is what Google calls the mute state, and currently you can only access that value with root by directly reading that file. Google称为“静音”状态是Zen模式,当前您只能通过直接读取该文件来使用root用户访问该值。 Hopefully with an update in the near future, google will expose this value to us. 希望在不久的将来进行更新,谷歌将向我们展示这一价值。

Did you try these? 你尝试过这些吗? It looks like you're looking for VOLUME, which doesn't exist in Android Wear. 看起来您在寻找VOLUME,而Android Wear中不存在。 https://stackoverflow.com/a/11985560/1539431 https://stackoverflow.com/a/11985560/1539431

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

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