Tkko / Flutter_Pinput

Flutter package to create Pin code input text field with every pixel customization possibility 🎨 with beautiful animations, iOS autofill, Android autofill
https://pub.dev/packages/pinput
MIT License
753 stars 175 forks source link

SMS autofill does not work on android #84

Closed ousvat closed 2 years ago

ousvat commented 2 years ago

I tried to use both androidSmsAutofillMethod.smsRetrieverApi and AndroidSmsAutofillMethod.smsUserConsentApi but none of them autocomplete the field when I am receiving a sms.

Here is all my code:

Pinput(
      controller: _textEditingController,
      length: widget.digitCount,
      keyboardType: widget.keyboardType,
      textCapitalization: widget.textCapitalization ?? TextCapitalization.none,
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      androidSmsAutofillMethod: AndroidSmsAutofillMethod.smsRetrieverApi,
      separator: SizedBox(width: 2),
      defaultPinTheme: _defaultPinTheme(),
      showCursor: false,
      focusedPinTheme: _defaultPinTheme().copyDecorationWith(
        border: Border.all(
          color: widget.hasSucceeded
              ? _succeedColor
              : Theme.of(context).colorScheme.primary,
          width: 2,
        ),
      ),
      errorPinTheme: _defaultPinTheme().copyDecorationWith(
        border: Border.all(
          color: Theme.of(context).colorScheme.error,
          width: 2,
        ),
      ),
      onCompleted: (code) {
        widget.onValidate(code);
      },
      onTap: () {
        if (widget.hasError) {
          _textEditingController.clear();
        }
        widget.onFocus();
      },
    );
  }
Tkko commented 2 years ago

@ousvat share the SMS content please.

ousvat commented 2 years ago

@ousvat share the SMS content please.

A sms looks like Activation code 1234 .

Tkko commented 2 years ago

@ousvat When use use androidSmsAutofillMethod: AndroidSmsAutofillMethod.smsUserConsentApi can't your see the dialog like this? Screenshot_20220330_173202 Post more details

ousvat commented 2 years ago

No.. I can't see anything.

Android version: 10 Flutter version: 2.10.3 Device: Samsung Note 9

Tkko commented 2 years ago

Try this on Android emulator and checkout the logs if plugin prints something in the console

    return Pinput(
      androidSmsAutofillMethod: AndroidSmsAutofillMethod.smsUserConsentApi,
    );

To receive message on emulator, settings-> phone

ousvat commented 2 years ago

There is nothing displayed in console..

Do you think it would be related to the app signature?

ousvat commented 2 years ago

There is nothing displayed in console..

Do you think it would be related to the app signature?

So yeah.. the issue is on the message form.. It should look like:

Activation code 1234
ufTCFrxN/y1
Tkko commented 2 years ago

smsUserConsentApi should work without the App signature, but since I can't reproduce the issue let's suppose the issue as closed, if this problem still remaining for anyone please let me know.

Keval-patel1 commented 4 months ago

disconnecting from surface 0xb4000075004d3300, reason disconnectFromSurface MediaCodec.release disconnect: api 3

I am facing this issue