volume - How to detect android phone ring and vibrate programmatically? -
audiomanager = (audiomanager)getsystemservice(context.audio_service); switch (am.getringermode()) { case audiomanager.ringer_mode_silent: log.i("myapp","silent mode"); break; case audiomanager.ringer_mode_vibrate: log.i("myapp","vibrate mode"); break; case audiomanager.ringer_mode_normal: log.i("myapp","normal mode"); break; }
from above code detect 1 mode. want check 2 mode either ring+vibrate or silent+vibrate.
how possible?
there no method ring+vibrate , silent+vibrate. know have 3 method ringer mode.
audiomanager.ringer_mode_normal audiomanager.ringer_mode_silent audiomanager.ringer_mode_vibrate
so , have create method check condition both ring , vibrate
like ring+vibrate.
public boolean statusringvibrate(){ boolean status = false; audiomanager = (audiomanager)getsystemservice(context.audio_service); if(am.getringermode() == audiomanager.ringer_mode_normal && am.getringermode() == audiomanager.ringer_mode_vibrate){ status = true; } return status; }
Comments
Post a Comment