SaveCallback
class SaveCallback
kotlin.Any | |
↳ | android.service.autofill.SaveCallback |
Handles save requests from the AutofillService
into the Activity
being autofilled.
Summary
Public methods | |
---|---|
Unit |
onFailure(message: CharSequence!) Notifies the Android System that an |
Unit |
Notifies the Android System that an |
Unit |
onSuccess(intentSender: IntentSender) Notifies the Android System that an |
Public methods
onFailure
fun onFailure(message: CharSequence!): Unit
Notifies the Android System that an AutofillService#onSaveRequest(SaveRequest, SaveCallback)
could not be handled by the service.
This method is just used for logging purposes, the Android System won't call the service again in case of failures—if you need to recover from the failure, just save the SaveRequest
and try again later.
Note: for apps targeting android.os.Build.VERSION_CODES#Q
or higher, this method just logs the message on logcat
; for apps targetting older SDKs, it also displays the message to user using a android.widget.Toast
.
Parameters | |
---|---|
message |
CharSequence!: error message. Note: this message should not contain PII (Personally Identifiable Information, such as username or email address). |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if this method, onSuccess() , or onSuccess(android.content.IntentSender) was already called. |
onSuccess
fun onSuccess(): Unit
Notifies the Android System that an AutofillService#onSaveRequest(SaveRequest, SaveCallback)
was successfully handled by the service.
Exceptions | |
---|---|
java.lang.IllegalStateException |
if this method, onSuccess(android.content.IntentSender) , or onFailure(java.lang.CharSequence) was already called. |
onSuccess
fun onSuccess(intentSender: IntentSender): Unit
Notifies the Android System that an AutofillService#onSaveRequest(SaveRequest, SaveCallback)
was successfully handled by the service.
This method is useful when the service requires extra work—for example, launching an activity asking the user to authenticate first —before it can process the request, as the intent will be launched from the context of the activity being autofilled and hence will be part of that activity's stack.
Parameters | |
---|---|
intentSender |
IntentSender: intent that will be launched from the context of activity being autofilled. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if this method, onSuccess() , or onFailure(java.lang.CharSequence) was already called. |