Skip to content Skip to sidebar Skip to footer

Xamarin Android: Detect If Audio Is Currently Playing On Device

At app launch, is it possible to detect if the device's audio player or another app is currently playing music?

Solution 1:

You can use the AudioManager to achieve this with it's IsMusicActive property:

AudioManager manager = (AudioManager)Android.App.Application.Context.GetSystemService (Android.Content.Context.AudioService);
var audioDetails = "Audio is " + (manager.IsMusicActive ? "on" : "off");

Post a Comment for "Xamarin Android: Detect If Audio Is Currently Playing On Device"