问题
I have been wondering if there is any way in the android API (or any other lib/framework) that can help me to detect if my device screen is mirrored using WiDi,Miracast or MHL or basically any other technique for mirroring your screen.
Br, Inx
回答1:
You may navigate through the list of all device display and get flags on each for finding one with, maybe, VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR ? Not sure but a few trys should allow you to figure out which ones will do it.
cf: DisplayManager and VirtualDisplay documentation
回答2:
I'm not sure what you are trying to achieve, but if you simply want to disable screenshots and such, you can use FLAG_SECURE
.
- https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE
- http://www.vogella.com/code/ApiDemos/src/com/example/android/apis/app/SecureWindowActivity.html
来源:https://stackoverflow.com/questions/18889685/how-to-detect-screen-mirroring