哪个 MediaRouter 用于检测音频路由?

Which MediaRouter to use for detecting audio routes?

我正在尝试检测(并收听)设备将音频路由到哪条路由(辅助、蓝牙、内置扬声器)。我看到 Google 有两个 MediaRouter 类,一个在

android.media.MediaRouter

另一个在

android.support.v7.media.MediaRouter

他们显然有不同的添加回调方法的实现。我应该使用哪一个?为什么?

Which one should I be using and why?

android.media.MediaRouter 是 API16+ 而 android.support.v7.media.MediaRouter 是 API7+ 所以基本上这完全取决于你的应用程序支持的最低 API 版本,但即使您的目标是 API16+,我也会考虑使用支持库,因为此版本可能会收到与设备内置版本相反的更新和错误修复。

实际上,在阅读了 Google 开发人员的 API 指南后, https://developer.android.com/guide/topics/media/mediarouter.html

它说:

Caution: There is another set of media router APIs provided in the android.media that have been superseded by the v7-mediarouter support library. You should not use the android.media classes for media router functions.

所以我想我应该使用 v7,根据 Google 的建议