Android icon indicating copy to clipboard operation
Android copied to clipboard

How to Play music in Google Play music or any media player app by pressing a button in activity of your app?

Open junaiiiid opened this issue 7 years ago • 2 comments

Hi, I'm making an app with a music widget it has the following buttons. Play, Pause, Previous track and Next track. how do I play music in the google play music app just by pressing the play button? any help would be appreciated thankyou.

junaiiiid avatar Dec 01 '18 20:12 junaiiiid

If you're building the app using the android studio, you will have to activate the mediaplayer service ie, music playing in the background.

kkshitij-agrawal avatar Dec 26 '18 08:12 kkshitij-agrawal

You can try something of this sort, Intent intent = context.getPackageManager().getLaunchIntentForPackage("com.google.android.music"); startActivity(intent); This would directly take you to the Google Play Music App. Hope this helps you @junaiiiid .

iamyashh avatar Feb 19 '19 08:02 iamyashh