Android Wear detect “Mute”

前端 未结 2 835
醉酒成梦
醉酒成梦 2021-02-06 13:22

How does an application check in on \"Mute\" status of an Android Wear device?

All volumes seem t be 0 no matter what.

Log.d(\"VOLUME - STREAM_SYSTEM\",          


        
2条回答
  •  后悔当初
    2021-02-06 13:55

    Unfortunately Google has not seen fit to expose this to us lowly developers at this time as far as I can tell.

    Thanks to the research of a friend of mine, Ive found this code.

    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. Hopefully with an update in the near future, google will expose this value to us.

提交回复
热议问题