Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

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.