List installed media players

北慕城南 提交于 2020-02-06 05:29:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!