0

i need to know in a background task if the user muted the ringer by clicking the volume button when a call is coming in. so there are 2 possible events that i could listen for:

  • volume button click (onKeyDown) - that would be the preferred method
  • ringer gets muted

it seems though that this is not possible. anyone has an idea how to accomplish that?

Thx Simon

SimonSays
  • 10,867
  • 7
  • 44
  • 59

3 Answers3

0

FYI: this is not possible, since the app in the foreground (the Phone app in the moment when the phone is ringing), handles the hardware button click. the event is not passed further.

SimonSays
  • 10,867
  • 7
  • 44
  • 59
0

There are no broadcasts for exactly what you want, but you can set up a content observer to be notified when settings change (including volume). Please checkout the answer here: Is there a broadcast action for volume changes?

Community
  • 1
  • 1
user496854
  • 6,461
  • 10
  • 47
  • 84
  • hmmm, i think i've made not totally clear what i am looking for in my question. i've re-wrote it here: http://stackoverflow.com/questions/7653722/listen-for-ringer-muted-on-incoming-call – SimonSays Oct 04 '11 at 20:37
0

Use BroadcastReceiver for this with android.media.RINGER_MODE_CHANGED

Also check AudioManager.VIBRATE_SETTING_CHANGED_ACTION ("android.media.VIBRATE_SETTING_CHANGED")

Vineet Shukla
  • 23,865
  • 10
  • 55
  • 63
  • hmmm, i think i've made not totally clear what i am looking for in my question. i've re-wrote it here: http://stackoverflow.com/questions/7653722/listen-for-ringer-muted-on-incoming-call – SimonSays Oct 04 '11 at 20:37
  • RINGER_MODE_CHANGED will not help you:http://stackoverflow.com/questions/3284693/how-to-receive-broadcasts-of-ringer-mode-changed-action – ekawas Dec 08 '11 at 21:00