有什么方法可以让应用程序:
我知道Android及更高版本能够在权限页面中检测屏幕覆盖,并在检测到屏幕覆盖时拒绝权限更改,但是开发人员能够在应用程序层实现相同的功能吗?
发布于 2019-03-09 10:46:22
当用户触摸您的MotionEvent.FLAG_WINDOW_IS_OBSCURED之一时,您可以通过检查是否有View标志来检测覆盖。
final View.OnTouchListener filterTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// Filter obscured touches by consuming them.
if ((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) != 0) {
if (event.getAction() == MotionEvent.ACTION_UP) {
Toast.makeText(v.getContext(), "Overlay detected", Toast.LENGTH_SHORT).show();
}
return true;
}
return false;
}
};
yourButton.setOnTouchListener(filterTouchListener);然而,我认为不可能检测到哪个应用程序拥有覆盖。
https://stackoverflow.com/questions/44197671
复制相似问题