YMusic is the one stop solution to all your music need.
Once installed, log in with your Google account. Once logged in you'll be able to see all your saved YouTube playlist.
Click the options button on the side of a playlist and Sync offline.
Now it'll always be played from the device itself. Perfect.
Not only that it also has some option for Shazam which I'm unable to test since I don't use Shazam at all.
Though it might not be acceptable to Google it does what it says. You'll have to install it through the apk you can download from any of the sites below.