What device are you using
Android Emulator Pixel 2
Hello all! I am trying to extend buttercup mobile in order to enable a user of the app to store his credentials into the application after they have entered them in i.e. Google Chrome, but after following instructions from Android Autofill Manager documentation (https://developer.android.com/guide/topics/text/autofill-services, section "Save User Data")
To save the data, the service must indicate that it is interested in storing the data for future use. Before the Android system sends a request to save the data, there is a fill request where the service has the opportunity to fill out the views. To indicate that it is interested in saving the data, the service includes a SaveInfo object to the response of the precedent fill request. The SaveInfo object contains at least the following data:
The type of user data that would be saved. For a list of the available SAVE_DATA values, see SaveInfo.
The minimum set of views that need to be changed to trigger a save request. For example, a login form typically requires the user to update the username and password views to trigger a save request.
So I am extending fillResponseBuilder in BCAutoFillService like that:
// Note the dataset MUST have values set. These aren't actually used so we'll just fill dummy values out
parseResult.email.forEach(id -> builder.setValue(id, AutofillValue.forText("-")));
parseResult.username.forEach(id -> builder.setValue(id, AutofillValue.forText("-")));
parseResult.password.forEach(id -> builder.setValue(id, AutofillValue.forText("-")));
Dataset dataSet = builder.build();
fillResponseBuilder
.addDataset(dataSet)
setSaveInfo(new SaveInfo.Builder(
SaveInfo.SAVE_DATA_TYPE_EMAIL_ADDRESS | SaveInfo.SAVE_DATA_TYPE_PASSWORD,
new AutofillId[] {parseResult.email.get(0), parseResult.password.get(0)}).build());
callback.onSuccess(fillResponseBuilder.build());
but the function onSaveRequest is never triggered after filling in the fields.
Any ideas? I looked for some example code/tutorial with little luck' most people have implemented the onFillRequest method, but not onSaveRequest.
What OS version are you using Android
What device are you using Android Emulator Pixel 2
Hello all! I am trying to extend buttercup mobile in order to enable a user of the app to store his credentials into the application after they have entered them in i.e. Google Chrome, but after following instructions from Android Autofill Manager documentation (https://developer.android.com/guide/topics/text/autofill-services, section "Save User Data")
So I am extending fillResponseBuilder in BCAutoFillService like that:
// Note the dataset MUST have values set. These aren't actually used so we'll just fill dummy values out parseResult.email.forEach(id -> builder.setValue(id, AutofillValue.forText("-"))); parseResult.username.forEach(id -> builder.setValue(id, AutofillValue.forText("-"))); parseResult.password.forEach(id -> builder.setValue(id, AutofillValue.forText("-"))); Dataset dataSet = builder.build(); fillResponseBuilder .addDataset(dataSet) setSaveInfo(new SaveInfo.Builder( SaveInfo.SAVE_DATA_TYPE_EMAIL_ADDRESS | SaveInfo.SAVE_DATA_TYPE_PASSWORD, new AutofillId[] {parseResult.email.get(0), parseResult.password.get(0)}).build()); callback.onSuccess(fillResponseBuilder.build());
but the function onSaveRequest is never triggered after filling in the fields.
Any ideas? I looked for some example code/tutorial with little luck' most people have implemented the onFillRequest method, but not onSaveRequest.
Thanks!