【问题标题】:Detect screen mirroring using xamarin.forms.android使用 xamarin.forms.android 检测屏幕镜像
【发布时间】:2020-12-16 10:06:44
【问题描述】:

我想检测安卓屏幕镜像到电脑。 我目前正在使用 c# Xamarin Forms Android 进行编码。

我做了什么

Here 有人推荐使用 DisplayManagerVirtualDisplay 文档。但我不知道如何在代码中实现。

Here有人建议检查DisplayManager.getDisplays(),看看它是否>1。再次无法检测到我尝试使用代码的 vysor。

【问题讨论】:

  • 检查ProjectMediaManagerProjectMedia

标签: android xamarin.forms display-manager android-virtualdisplay


【解决方案1】:

在 Android 中无法这样做。

Reference

最接近的方法是使用FlagSecure 来防止屏幕截图。

【讨论】:

  • 请查看我引用的答案
  • 我们都有新东西要learn
【解决方案2】:

最后我得到了有效的答案。
像 vysor 这样的 Android 镜像无法在没有启用开发者选项的情况下进行镜像。
要检查是否可以运行镜像,请检查以下代码:

//https://stackoverflow.com/a/31582092/11390822

var context = Android.App.Application.Context;
var resolver = context.ApplicationContext.ContentResolver;
if (Settings.Secure.GetInt(resolver, Settings.Global.DevelopmentSettingsEnabled, 0) == 1)
{
//Developer options enabled
//Mean vysor can mirror
}
else
{
//Developer options disabled
//Mean vysor can't mirror now
}

【讨论】:

    猜你喜欢
    • 2013-09-24
    • 2012-04-13
    • 1970-01-01
    • 2023-03-08
    • 2018-04-20
    • 2017-02-14
    • 2014-01-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多