2

I want to hide our Android application from remote Device Access like TeamViewer, anyDesk for security reasons.

Requirement is when user phone is given for remote access, if my application is opens then other person has to see black screen instead of my app.

For example:- In Mobile A has my app let's say ABC App, Now Mobile A given remote access to Mobile B.Now when Mobile A opens ABC App then Mobile B has to see black screen instead of ABC App.

David Buck
  • 3,752
  • 35
  • 31
  • 35
Shivam Sharma
  • 290
  • 2
  • 14
  • https://stackoverflow.com/a/9822607/115145 – CommonsWare Oct 11 '19 at 12:05
  • This is not database content or data. Actually i don't want share my app screen to remote access tools. @CommonsWare – Shivam Sharma Oct 11 '19 at 12:07
  • "i don't want share my app screen to remote access tools" -- use `FLAG_SECURE`, as I indicated in my linked-to answer. – CommonsWare Oct 11 '19 at 12:18
  • I already tried this `FLAG_SECURE` flag using like this ```getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);``` But this flag prevent to take screenshot. @CommonsWare – Shivam Sharma Oct 11 '19 at 12:21

2 Answers2

3

If FLAG_SECURE does not work (it is blocking screenshots and screencasts but not blocking a particular remote-support app), then the remote-support app vendor has partnered with the device manufacturer for low-level access (e.g., direct access to framebuffers). There are no defenses against this.

The best that you can do is try to come up with a blacklist of apps, use PackageManager to see if any of those apps are installed, and refused to show various screens in your app until the user uninstalls those other apps.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

The best that you can try getWindow().getWindowManager() before setContentView() on Activity which you don't want to share. This will protect the screen.

bad_coder
  • 11,289
  • 20
  • 44
  • 72