yong
yong

Reputation: 63

how to get a list of the installed audio players?

Is it possible to get a list of the installed audio players?

I guess I could do that as following.

        Intent intent = new Intent();
    intent.setAction(android.content.Intent.ACTION_SEND);
    intent.setType("audio/*");
    List<ResolveInfo> apps = getPackageManager().queryIntentActivities(intent, 0);

But I got nothing.

Could anyone help me? T_T

Upvotes: 2

Views: 624

Answers (2)

Infinite Recursion
Infinite Recursion

Reputation: 6557

Try this:

    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI,"1"); 
    intent.setData(uri);
    intent.setType("audio/*");
    List<ResolveInfo> apps = getPackageManager().queryIntentActivities(intent, 0);
    for (ResolveInfo rInfo : apps) {
        //process list here
    }

Upvotes: 2

Oleg Gordiichuk
Oleg Gordiichuk

Reputation: 15512

This code sniper lets you choose at first from you're installed audio players and then gives opportunity to play music from them.

   Intent intent = new Intent(Intent.ACTION_GET_CONTENT, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
   intent.setType("audio/mpeg3");
   startActivityForResult(intent, REQUEST_CODE);

Upvotes: 0

Related Questions