How do I prevent Android taking a screenshot when my app goes to the background?

前端 未结 6 1309
说谎
说谎 2020-11-22 08:15

The app I\'m currently building has the requirement that the app has to prevent the OS to take a screenshot of the app when it\'s being pushed into the background for securi

6条回答
  •  佛祖请我去吃肉
    2020-11-22 08:31

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
                WindowManager.LayoutParams.FLAG_SECURE);
    

    this worked for me, it prevents from taking screenshot and also any inbuilt or third party recording application from recording screen.

提交回复
热议问题