telephonymanager - android audio manager in receiver class -


Switching back to the user's mode I mean when the phone is silent and I have selected some selected numbers Used to ring, but this phone mode does not return to normal mode when it is inactive. Here's my piece of code .........

  if (IncomingNumber.equals (WhitelistedNumbers)) {am.setRingerMode (AudioManager.RINGER_MODE_NORMAL); System.out.println ("Number matching ......!"); System.out.println ("Whitelisted Number (Numbers):" + Whitelisted Numbers); } And {System.out.println ("No matches found .....!"); }  

and switch back to normal mode using ........ Case Telephony Manager. CALL_STATE_IDLE: am.setRingerMode (AudioManager. RINGER_MODE_NORMAL); System.out.println ("Set the default bell mode ....!"); break;

Any suggestions for solving the problem, if thank you in advance ........

You have to save the last bell mode in a variable, and then it must be restored from that variable.

  int previousMode; If (IncomingNumber.equals (Exclamation number)) {previousMode = am.getRingerMode (); Am.setRingerMode (AudioManager.RINGER_MODE_NORMAL); ....}  

and to restore:

  am.setRingerMode (previous mode);  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -