sms_autofill
sms_autofill copied to clipboard
SmsAutoFill.listenForCode throw PlatformException
The library works great in most cases. But sometimes I got below exception when calling SmsAutoFill.listenForCode:
PlatformException(ERROR_START_SMS_RETRIEVER, Can't start sms retriever, null, null)
Anyone else is facing the similar issue? Is it a good idea to retry listen for code in this case?
Anyway, the exception does not give me the details of the error. Can SmsAutoFillPlugin.java be improved to pass the error detail back to flutter? Currently it passes the error details as null:
task.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
result.error("ERROR_START_SMS_RETRIEVER", "Can't start sms retriever", null);
}
});
Seems like a good idea. I'll take a look next week to see if we can at least include the exception message so we can debug it further. You can always open a PR if you beat me to it.
Seems like a good idea. I'll take a look next week to see if we can at least include the exception message so we can debug it further. You can always open a PR if you beat me to it.
On the other hand, could this line not be invoked when on the web ?
Future<void> get listenForCode async {
// if (kIsWeb) return;
await _channel.invokeMethod('listenForCode');
}
Else your widget throws an error on the web and there is no way this method is going to be available on the web when not a phone.