At least with the recent Pixels there's an option to have your phone listen 24/7 and tell you what music is playing.
Probably difficult to distinguish this tower from a homeless guy sitting in a subway station listening to different music all day.
That app ("Now playing") is the same technology as Shazam but it's local, because this isn't actually difficult on modern hardware. It's the same technique the Pixel uses to notice that somebody said "Google" to it, again without needing a remote server.
Now Playing has a smaller database than Shazam does but the technology would work fine with a larger database if you wanted that, which for this application you might.
However, unsurprisingly Google did not give away the technology.
That app ("Now playing") is the same technology as Shazam but it's local, because this isn't actually difficult on modern hardware. It's the same technique the Pixel uses to notice that somebody said "Google" to it, again without needing a remote server.
Now Playing has a smaller database than Shazam does but the technology would work fine with a larger database if you wanted that, which for this application you might.
However, unsurprisingly Google did not give away the technology.