且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我如何prevent的Andr​​oid获取屏幕截图时,我的应用程序去的背景是什么?

更新时间:2021-07-30 09:14:03

尝试 FLAG_SECURE

public class FlagSecureTestActivity extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    setContentView(R.layout.main);
  }
}

这绝对保证免受来自ICS近期任务的历史手动截图和自动截屏。

This definitely secures against manual screenshots and automatic screenshots from the ICS recent-tasks history.

更新:这也保证了对现在在Android上6.0轻触或其它助剂;他们将不能访问部件和集装箱在UI的详细信息,如果用户带来了助手。

UPDATE: it also secures against Now On Tap or other assistants on Android 6.0; they will not get access to the details of widgets and containers in your UI if the user brings up the assistant.