But, as The Verge reports, the app has now been updated to detect music played through your headphones as well.
When you turn on the Pop-up Shazam feature, it adds a persistent notification to your Android notification drawer. You can hit the notification to bring up a floating Shazam icon which sits on top of your apps such as YouTube or a browser. When you tap the floating icon, it'll show you details relating to the current track.
For now, the feature is only available in the latest Android version of the app, and isn't available on iOS - even though Apple bought Shazam last year. This is likely because iOS doesn't allow background apps to monitor audio coming from foreground apps for security reasons.