Friday, 4 September 2020

Detect screen mirroring xamarin.android like vysor

enter image description here

I want my app should notify when my app is used in screen mirroring. Likewise I use vysor for getting android screen in pc, but I need to detect and close when detected (due to screen recording protection).

I need working c# code example for Xamarin Android.

What I have done

Here someone recommended to use DisplayManager and VirtualDisplay documentation. But I don't know how to achieve that in code.

Here someone recommended to check DisplayManager.getDisplays(), and see if it's >1. Again not working to detect vysor I tried with code.

Update:

Please tell me what I am doing wrong ? It gives 1 while both in emulator and device while vysor android mirror. Here's code implementation:

public static bool IsMirror()
{
    DisplayManager DisplayManager = (DisplayManager)Application.Context.GetSystemService(Android.Content.Context.DisplayService);
    return DisplayManager.GetDisplays().Length > 1;
}


from Detect screen mirroring xamarin.android like vysor

No comments:

Post a Comment