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

前端 未结 6 1313
说谎
说谎 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

    This is work for me after adding these line into the onCreate before setContentView of every activity.

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,     
    WindowManager.LayoutParams.FLAG_SECURE);
    setContentView(R.layout.activity_notification);
    

提交回复
热议问题