jaumard / sms_autofill

Flutter plugin to provide SMS code autofill support
MIT License
281 stars 173 forks source link

codeUpdated() callback not called #164

Open lironzemingo opened 2 years ago

lironzemingo commented 2 years ago

Hi I cant seem to get my app (Android) to read the sms with the code. I add the hash at the end of the sms, as printed by the "getSignature" method. but I dont even get the codeUpdated() callback .

any thoughts as to why this is not working? should I have added something in the manifest?

This is My sms: Your code for the app is 123456 ZSUCt82wXvj

This is my basic code:


Class OTPField extends StatefulWidget {
  const OTPField({Key? key}) : super(key: key);

  @override
  _OTPFieldState createState() => _OTPFieldState();
}

class _OTPFieldState extends State<OTPField> with CodeAutoFill {
  final textEditingController = TextEditingController();
  final cubit = locator.get<OTPCubit>();

  @override
  void initState() {
    super.initState();
    SmsAutoFill().getAppSignature.then((value) => Fimber.i("signature:$value"));
    listenForCode();
  }

 @override
  Widget build(BuildContext context) {
....
}
 @override
  void codeUpdated() {
    Fimber.i("code: $code");
  }
}

thanks

hamidullo7 commented 1 year ago

I faced the same issue!