how to detect screen mirroring

被刻印的时光 ゝ 提交于 2019-12-07 08:34:19

问题


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

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