Reference:
只要在呼叫setContentView()之前設定FLAG_SECURE的windows flag,這個頁面就無法被截圖或錄影
按 hardware key截圖時,會出現下列的log
01-01 21:11:50.538 10930-10930/?
D/ScreenshotUtils: notifyScreenShotError, first screenshot
Code snippet:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE);
setContentView(R.layout.activity_main);
...
}
沒有留言:
張貼留言