Anchor crane, how to prevent it

Trying to avoid my views involves getting feedback from the overlays ....

Here is an example of a hack that someone could do on Android to allow the user to inadvertently press a property of a system button or even enter credentials to do something completely different from the original intention:

http://www.youtube.com/watch?v=gCLU7YUXUAY

I would like to confirm that setting the property

android:filterTouchesWhenObscured="true"

in my view, xml would prevent this from happening on different devices, like intending to make a secure application.

+4
source share
1 answer
public class MyActivity extends Activity {
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        final Button myButton = (Button)findViewById(R.id.button_id);
        myButton.setFilterTouchesWhenObscured(true);
        myButton.setOnClickListener(new View.OnClickListener() {
            // Perform action on click
            public void onClick(View v) {

            }
        }
    }
}

write this code for critical buttons

+4
source

Source: https://habr.com/ru/post/1530075/


All Articles