Skip to content

khalti/android_sms_consent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android SMS Consent

Flutter plugin to perform one-tap SMS verification with the SMS User Consent API in Android.

The following criteria must meet for the API to be triggered:

  • The message contains a 4-10 character alphanumeric string with at least one number.
  • The message was sent by a phone number that's not in the user's contacts.
  • If you specified the sender's phone number, the message was sent by that number.

Usage

  final androidSmsConsent = AndroidSmsConsent(
    pattern: r'\d{4,}',
    onAllowed: (sms) {
      print(sms);
    },
    onDenied: () {
      _scaffoldMessenger?.showSnackBar(
        const SnackBar(content: Text('User denied!')),
      );
    },
    onPatternUnmatched: () {
      _scaffoldMessenger?.showSnackBar(
        const SnackBar(
          content: Text('OTP not found! Please try entering OTP manually.'),
        ),
      );
    },
  )..start('TestOne');

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published