0

I am building an app where i am trying to play music in google play music by using sendBroadcast() but i am unable to play any of the song

music.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                   Intent i = getPackageManager().getLaunchIntentForPackage("com.google.android.music");
                    if (i != null) {
                        i.putExtra("command", "play");
                        Log.i("hjf","uefh");
                        sendBroadcast(i);
    }

                    startActivity(i);
    }

the logs being generated are

06-21 15:12:16.171 13805-13805/com.example.hp.ideaquestqualcomm D/ViewRootImpl: ViewPostImeInputStage processPointer 0
06-21 15:12:16.271 13805-13805/com.example.hp.ideaquestqualcomm D/ViewRootImpl: ViewPostImeInputStage processPointer 1
06-21 15:12:16.271 13805-13805/com.example.hp.ideaquestqualcomm I/hjf: uefh
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • 1
    On what site did you learn about ` Intent i = getPackageManager().getLaunchIntentForPackage("com.google.android.music");`? – Zun Jun 21 '18 at 09:45
  • https://stackoverflow.com/questions/36244479/how-to-launch-an-app-from-another-app-in-android from this link i got to know how to launch another app from some – shaista ambreen Jun 21 '18 at 09:53
  • I'm just curious to know what documentation you followed. I personally do not use google music but it feels like you're just guessing code and hoping it works. – Zun Jun 21 '18 at 09:56
  • @ZUNJAE Is there any way to achieve this? – shaista ambreen Jun 21 '18 at 13:38

0 Answers0