Detecting if Audio is Playing on Device

Is it possible to detect if audio is playing from a source outside of the app?

Example:
1. Play a song on the device.
2. Launch app.

In the launched app is is possible to detect the music playing on the device?

Answers

  • rzee7rzee7 INUniversity ✭✭✭✭✭

    Hi @RichardBlaylock

    You can do this by using SystemService as following:

      AudioManager manager = (AudioManager)this.GetSystemService(Context.AudioService);
       if (manager.IsMusicActive)
       {
        // do something - or do it not
       } 
    

    Cheers!!
    RIYAZ

Sign In or Register to comment.