列出已安装的媒体播放器 [英] List installed media players

查看:82
本文介绍了列出已安装的媒体播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取可以处理Android上安装的媒体的所有应用程序的列表.

I'm trying to get a list of all apps that can handle media installed on Android.

我已经尝试了此处中列出的方法,但是这些方法均无效.它们都返回一个空列表,并且我安装了多个媒体播放器,它们都被Headset Droid识别( https://play.google.com/store/apps/details?id=tvk.headvol ).

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?

推荐答案

这是我想出的:

PackageManager packageManager = this.getPackageManager();
List<ResolveInfo> pkgAppsList;
Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON);
pkgAppsList = packageManager.queryBroadcastReceivers(intent, 0);

这提供了所有可以处理ACTION_MEDIA_BUTTON意向的应用程序的列表.这些通常是媒体应用.

This provides a list with all apps that can handle the ACTION_MEDIA_BUTTON intent. These are normally the media apps.

这篇关于列出已安装的媒体播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆