Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Wear detect "Mute"

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", 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
like image 757
r2DoesInc Avatar asked Sep 30 '22 08:09

r2DoesInc


1 Answers

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.

like image 128
r2DoesInc Avatar answered Oct 04 '22 12:10

r2DoesInc