How to detect external displays in android preceding API 17

I work in a copyrighted application that should only work on an Android device and not on an external display connected via HDMI or wirelessly. I found an excellent Presentation and DisplayManager APIs to detect and control what content should be displayed on external ones, but this API is only available in API 17 (android 4.2) and plus. Any idea is how to do this under Android 4.0, or at least to detect and notify for connected displays.

Question # 2: How about whether an Android device is connected for recording on the screen. Can Presentation or DisplayManager help find this?

+7
android display-manager
source share
2 answers

Any idea is how to do this under Android 4.0, or at least to detect and notify for connected displays.

Besides, possibly, MediaRouter in API level 16, as indicated in Distwo's answer, there was no support for application-level access to external displays in older versions of Android. Relatively few devices even supported external displays; those that offered only OS-level mirroring.

Best of all, if you want to call it, is to access several of these devices and see if there are general LogCat messages that indicate the presence of external displays or maybe some things at the Linux level in /proc . However, there is a very good chance that they will differ from the manufacturer and device.

How about whether an Android device is connected to record on the screen. Can the Presentation or DisplayManager API find this?

Not.

+1
source share

Returning to API 16, you can use the MediaRouter class. Cf android developer website.

To get the default display for the presentation, call MediaRouter.getSelectedRoute () and pass it to ROUTE_TYPE_LIVE_VIDEO. This returns a MediaRouter.RouteInfo object that describes the currently selected route for the video presentations. If MediaRouter.RouteInfo is not null, call getPresentationDisplay () to get a display showing the connected display.

Full source: http://developer.android.com/about/versions/android-4.2.html#SecondaryDisplays

+2
source share

All Articles