title: OnAudioFocusChangeListener is not executed when the audio is played and paused?
body: <p>I am developing an application, in which i need to capture the audio being played. So i implemented OnAudioFocusChangeListener in my activity to listen for any audio changes. But the listener is not getting called when music is played or paused. Below is my code </p>
  
  <pre><code>public class AudioManagerExample extends Activity implements OnAudioFocusChangeListener{
    AudioReceiver adreceiver;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      AudioManager am =   (AudioManager) getSystemService(AUDIO_SERVICE);
  
  }
  
  @Override
  public void onAudioFocusChange(int focusChange) {
      Log.d("AudioManager", "Inside on audio focus change");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Where am i wrong? Is there any alternative way to do this?</p>
  
  <p>Thanks</p>
  
  <p>Pushpa</p>