android / input-samples

Multiple samples showing the best practices in input on Android.
Apache License 2.0
288 stars 265 forks source link

How does Credit Card autofill actually work? #60

Open misael-jonathan opened 8 months ago

misael-jonathan commented 8 months ago

Hi, I am currently trying to use credit card autofill in my Credit Cart Bill Payment page. In my case, I only need the credit card number. So in my first poc, I use a single field with autofillHints attr set with AUTOFILL_HINT_CREDIT_CARD_NUMBER. But the autofill recommendation on the keyboard didn't show at all.

After some checking, seems like a single field is not sufficient. I also need another view present in the layout, that is a view with autofillHints attr set with AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE or portions of the expiration date, and they have to be visible (width/height != 0, visibility == visible). Idk why, did some experiment and seems so.

But I don't need the expiration date at all. What I can do right now is by setting the height and width to 0,01dp, so the field doesn't appear to the users.

My question is, do I really need expire date field to be able to use the autofill feature? or can I achieve that with only a single field (creditCardNumber)?