问题
I'm trying to get a list of all apps that can handle media installed on Android.
I've tried the methods listed here, but none of them worked. They all return an empty list and I have multiple media players installed, which are all recognized by Headset Droid (https://play.google.com/store/apps/details?id=tvk.headvol).
Can anybody suggest any alternative method or might have and idea what the problem can be? Do I need to set any permissions?
回答1:
Here is what I came up with:
PackageManager packageManager = this.getPackageManager();
List<ResolveInfo> pkgAppsList;
Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON);
pkgAppsList = packageManager.queryBroadcastReceivers(intent, 0);
This provides a list with all apps that can handle the ACTION_MEDIA_BUTTON
intent. These are normally the media apps.
来源:https://stackoverflow.com/questions/18161237/list-installed-media-players