• Announcements

    • andrewilley

      Poweramp v3 Project Update   04/24/2017

      As you may be aware, the Poweramp developer has been working hard on an updated material design user interface for Poweramp v3 which required a full ground-up rebuild of the code and is taking some time to get to a beta-test stage. See the forum thread for more details and to discuss.    
TheoKlink

How to launch Poweramp from another andoid app into playing an m3u playlist

4 posts in this topic

I have the following code which works for Google Play Music but partly for Poweramp

 

      public void playSelectedPlaylist(String playlistname) {

        Intent intent = new Intent( MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH);

        intent.putExtra(MediaStore.Audio.Playlists.ENTRY_CONTENT_TYPE, "android.intent.extra.playlist" );

        intent.putExtra(SearchManager.QUERY, playlistname);

        intent.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, "vnd.android.cursor.item/playlist");

 

        if (intent.resolveActivity(getPackageManager()) != null) {

            startActivity(intent);

        }else{

            doToast("Sorry, no app was found to service this request", context);

        }

    }

 

 

The intent is INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH and it finds all those apps that have this in their manifest.xml file. So far so good as Poweramp shows up.

 

Selecting  Poweramp from the choices does present the user with the appropriate playlist. When clicking this and select "Play" nothing happens other than Poweramp asking me if I want to play filtered or play all. Selecting either has not effect as nothing happens

 

The intent.putExtra(SearchManager.QUERY, playlistname) is as follows:

[ResolveInfo{410e93c8 com.maxmpz.audioplayer.PlayListActivity p=0 o=0 m=0x108000}]

 

Poweramp has the following actions for PlayListActivity

- ACTION_SHOW_CURRENT

- ACTION_SHOW_LIST

- SEARCH

- MEDIA_SEARCH

- CREATE_SHORTCUT

 

The PlayerUIActivity has

- VIEW

- MEDIA_PLAY_FROM_SEARCH

 

Looking at this I assume that Poweramp reacts as a potential app to handle the activity but when it then has to deal with a playlist, there is no action to process it.

Is my assumption correct? If so, will this functionality be added to the next release?

 

 

 

Google Play Music does play the playlist without any problems.

 

Anyone with suggestions, thoughts I can try out?

Share this post


Link to post
Share on other sites

I finally managed to get a Poweramp Playlist to be launched from within another app (New Playlist Manager).

For those interested:

public void playSelectedPlaylist(String playlist_id){

    Intent intent = new Intent(PowerampAPI.ACTION_API_COMMAND);
            intent.putExtra(PowerampAPI.COMMAND, PowerampAPI.Commands.OPEN_TO_PLAY)
                    .setData(PowerampAPI.ROOT_URI.buildUpon()
                    .appendEncodedPath("playlists")
                    .appendEncodedPath(playlist_id)
                    .appendEncodedPath("files")
                    .build());
    Intent explicit_intent = new Intent(createExplicitFromImplicitIntent(getActivity(), intent));
    getActivity().startService(explicit_intent);

}

The Poweramp library needs to be included.

ps. I have not shown the createExplicitFromImplicitIntent method but contact me if you want this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now