I have an app with a login page. In the login page, I have a switch to allow the user to show the password they are entering in plain text to ensure they are entering it correctly. However, when I pause the app and the app goes into the background, a screenshot is taken and the plain text password can be seen in the app drawer.
I tried adding a statement in the onPause() method of the activity to turn off the Hide/Show switch before pausing. You can see the password revert back to a masked password before the app pauses, but the screenshot still shows the plain text password.
So I'm wondering when the screenshot for the app drawer is taken and whether I can get the password switched back to masked before that happens.
I know about the FLAG_SECURE window flags but that creates a black app drawer screenshot and I would prefer to give something more user-friendly to the user.
Thanx in advance.
Unfortunately, what you want is not supported. There is a method in Activity called onCreateThumbnail()
that can be overridden to provide a custom thumbnail, but according to a post from Dianne Hackborn in 2009, this method is never actually called:
https://groups.google.com/d/msg/android-developers/J5uBtHzhG8E/bX43j_GAm4gJ
I've tried it relatively recently myself to no effect, so I have to assume that's still the case.