How to detect screen mirroring in android when my mobile screen is shared using teams presentation?

2.7k views Asked by At

For enhanced security of My Android App, I need to detect the screen mirrioring. I have implemented this below source code:

var display : DisplayManager = getSystemService(DISPLAY_SERVICE) as DisplayManager

var presentationdisplay= display.getDisplays(DISPLAY_CATEGORY_PRESENTATION).size

Toast.makeText(this, "disp size "+presentationdisplay, Toast.LENGTH_SHORT).show()

if(presentationdisplay>0) {
    Toast.makeText(this, "your Mobile screen is shared by other app", Toast.LENGTH_SHORT).show()
}

The code is able to detect Screen Casting and the screen share of GoogleMeet, TeamViewer. But it is not detecting the MicrosoftTeams and Zoom screen Sharing. I have found that MicrosoftTeams and Zoom are using FLAG_PRIVATE and FLAG_PRESENTATION whereas GoogleMeet, TeamViewer are using only FLAG_PRESENTATION. I assume that they are securing their virtualdisplay as private using FLAG_PRIVATE. Is there any way to detect Screen Mirroring with FLAG_PRIVATE?

1

There are 1 answers

1
Mahesh Gv On

use this library flutter_windowmanager: ^0.2.0

to avoid and detect screen share FLAG_TURN_SCREEN_ON

for more details