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
773 stars 178 forks source link

Can't get smsUserConsentApi to work on Android #130

Closed abdullah10182 closed 1 year ago

abdullah10182 commented 1 year ago

Hi,

I've been trying to get the smsUserConsentApi method to work with no luck. The dialog does not show.

I run the example app on my phone and it works as it should. I've copied the whole "PinputExample" widget from the example app into my app and still cannot get it to work.

Am I missing something on the Android side or something? I've checked the manifest file but can't find anything in particular.

Any help would be appreciated, thanks.

Tkko commented 1 year ago

Hey @abdullah10182, Are you using Firebase auth?

abdullah10182 commented 1 year ago

No, I'm using app_auth with custom authentication.

But I am using firebase analytics wich requires firebase_analytics and firebase_core.

Tkko commented 1 year ago

I can't find the package named app_auth, could you give me the pub link

abdullah10182 commented 1 year ago

it's this one: https://pub.dev/packages/flutter_appauth

Tkko commented 1 year ago

I don't see any problem with that package, is there any error printed in the console?

abdullah10182 commented 1 year ago

I basically removed every lib from my app and got it to work.

I'm gonna spend the rest of the day trying to figure out what is causing the issue. Will follow up and let you know what is causing it.

Thanks

abdullah10182 commented 1 year ago

Is there a way to trigger the sms listener manually? I use riverpod which uses watchers, and noticed every time I have listeners in a widget it does not work. Although I've tried to import riverpod in the example app and it works perfectly. So not sure what it might be.

So the only thing I can think of now is to start the listener manually after all watchers have been loaded.

Tkko commented 1 year ago

Hey @abdullah10182, sorry for the late reply, you can start listening by manually by using SmartAuth class, it's exported from the Pinput so you don't have to add plugin manually.

    final smartAuth = SmartAuth();
    final res = await smartAuth.getSmsCode();
Tkko commented 1 year ago

Closing the issue for now, feel free to reopen if needed.