Skip to content

Commit

Permalink
added : Dependencies upgrade and Code cleanup , Update README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
TandohAnthonyNwiAckah committed Sep 20, 2024
1 parent 9a47150 commit 45deb0a
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 95 deletions.
63 changes: 39 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
# otp_autofill_sms

`otp_autofill_sms` is a Flutter plugin designed to simplify OTP (One-Time Password) autofill for Android applications.
`otp_autofill_sms` is a Flutter plugin designed to simplify OTP (One-Time Password) autofill for
Android applications.

This plugin is available only for Android, as iOS handles OTP autofill natively. While iOS users benefit from built-in OTP autofill functionality, this plugin provides a seamless experience for Android users by managing OTP autofill without requiring SMS read permissions, thus enhancing user convenience.
This plugin is available only for Android, as iOS handles OTP autofill natively. While iOS users
benefit from built-in OTP autofill functionality, this plugin provides a seamless experience for
Android users by managing OTP autofill without requiring SMS read permissions, thus enhancing user
convenience.

## Features

- **Automatic OTP Detection**: Automatically captures and fills OTPs sent via SMS, enhancing user convenience.
- **Automatic OTP Detection**: Automatically captures and fills OTPs sent via SMS, enhancing user
convenience.

- **No SMS Permissions Required**: Utilizes the [SMS User Consent API](https://developers.google.com/identity/sms-retriever/user-consent/overview) to function without needing explicit SMS read permissions.
- **No SMS Permissions Required**: Utilizes
the [SMS User Consent API](https://developers.google.com/identity/sms-retriever/user-consent/overview)
to function without needing explicit SMS read permissions.
- **Easy Integration**: Simple setup and integration with your Flutter project.

## Screenshots

| Default Screen | OTP Autofill |
|-------------------------------------------|-------------------------------------------|
| ![Main Page](screenshots/screenshot1.png) | ![Main Page](screenshots/screenshot2.png) |

## How It Works

The plugin leverages Google's SMS Retriever API to detect OTPs automatically. To ensure proper detection, the SMS message must adhere to specific formatting rules:
The plugin leverages Google's SMS Retriever API to detect OTPs automatically. To ensure proper
detection, the SMS message must adhere to specific formatting rules:

### SMS Formatting Guidelines

Expand All @@ -23,10 +37,11 @@ The plugin leverages Google's SMS Retriever API to detect OTPs automatically. To

- **End String**: The message should end with an 11-character hash string that identifies your app.


### Example SMS Format

> Your ExampleApp code is: 123456 FA+9qCX9VSu
> Your ExampleApp code is: 915456 FA+9qCVSz
**Make sure to generate the Signature Code for both the release and debug versions of your app and append it to your message.**


## Installation
Expand All @@ -46,40 +61,40 @@ To add `otp_autofill_sms` to your Flutter project, follow these steps:
## Setup Instructions

1 **Flutter Integration**: Import and initialize the plugin in your Dart code:
```dart
import 'package:otp_autofill_sms/otp_autofill_sms.dart';
```
```dart
import 'package:otp_autofill_sms/otp_autofill_sms.dart';
```

2 **Basic Usage**:
```dart
```dart
// Get the app signature code.
Future<void> _getSignatureCode() async {
String? signature = await OtpAutofillSms.getAppSignature();
if (kDebugMode) {
print("Signature: $signature");
}
}
// Start listening for incoming SMS messages
void _startListeningSms() {
OtpAutofillSms.startListeningSms().then((message) {
setState(() {
if (kDebugMode) {
print("Message: $message");
}
});
});
}
```

## Screenshots

```


## Contributing

Contributions are welcome! If you find any bugs or have ideas for improvements, please submit a pull request or open an issue on the [otp_autofill_sms repository](https://github.com/TandohAnthonyNwiAckah/otp_autofill_sms)
Contributions are welcome! If you find any bugs or have ideas for improvements, please submit a pull
request or open an issue on
the [otp_autofill_sms repository](https://github.com/TandohAnthonyNwiAckah/otp_autofill_sms)


Loading

0 comments on commit 45deb0a

Please sign in to comment.