FabriBertani/Plugin.Maui.ScreenSecurity

Android Emulator - Take screenshot (ctrl+s) is still capturing the screen.

Closed this issue · 4 comments

I've added the following code to an OnAppearing method:

    protected override void OnAppearing()
    {
        base.OnAppearing();

#if ANDROID
ScreenSecurity.Default.ActivateScreenSecurityProtection();
#elif IOS
var screenProtectionOptions = new ScreenProtectionOptions
{
HexColor = "#6C4675",
PreventScreenshot = true,
PreventScreenRecording = true
};

        ScreenSecurity.Default.ActivateScreenSecurityProtection(screenProtectionOptions);

#endif
}

But when I run the code through an Android emulator, a screen shot (ctrl+s) is still being captured!

I'm using:
Windows 11 Home.
Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.8.5.
Android 14.0 - API 34.
Android Emulator - Pixel 5.

Thank you in advance for your help.

Kind regards,

Darren

I should have also mentioned that I'm using:
Plugin.Maui.ScreenSecurity - version 1.1.6.
.Net - version 8.

Thank you & kind regards,

Darren

After further testing today, it would appear that when you go into multi-window mode in the emulator the take screenshot option there (at the bottom of the emulator) is indeed disabled.

However, the take screenshot (ctrl+s) option to the right of the emulator still captures the screen.

I must admit that I'm new to mobile app delelopment, so please accept my apologies if I'm mis-understanding.

Kind regards,

Darren

Hi @darrenjlewington how are you?

Yes, most of this stuff is better to test on a physical device, emulators and simulators sometimes are mixed with the host OS and things like screenshots are taken by the host OS instead of the emulator/simulator.

I'll close this for now. Re-open it if you have any further issues.