Skip to content

Repository files navigation

📦 SmsFlutter Plugin

SmsFlutter is a Flutter plugin for sending and receiving SMS messages, checking SIM count, and managing SMS permissions on Android devices. It allows you to send SMS messages through a specific SIM slot (for dual-SIM devices), receive incoming SMS messages, and request necessary permissions from the user.


🚀 Features

  • Send SMS using a selected SIM card
  • Receive SMS messages
  • Get the number of active SIM cards
  • Check SMS permissions
  • Request SMS permissions

📲 Platform Support

PlatformSupport
Android✔️
iOS

📥 Installation

Add the dependency to your pubspec.yaml:

dependencies:
sms_flutter:
path: ./path_to_your_plugin

🧑‍💻 Usage

Import the plugin:

import'package:sms_flutter/sms_flutter.dart';
final sms =SmsFlutter();

Example

voidmain() async {
final sms =SmsFlutter();
// Check permissionsbool hasPermission =await sms.checkPermissions();
if (!hasPermission) {
await sms.requestPermissions();
}
// Get SIM countint simCount =await sms.getSimCount();
print("SIM Count: $simCount");
// Send SMSString result =await sms.sendSmsWithSim(
phoneNumber:'+1234567890',
message:'Hello from Flutter!',
simSlot:0,
);
print("SMS Send Result: $result");
// Receive SMSMap<String, String> received =await sms.receiveSms();
print("Received SMS: $received");
}

📊 Function Table

Function NameParametersReturn TypeDescription
getSimCount()NoneFuture<int>Returns the number of SIM cards available on the device.
sendSmsWithSim()phoneNumber: String
message: String
simSlot: int (default: 0)
Future<String>Sends an SMS via the specified SIM slot.
receiveSms()NoneFuture<Map<String,String>>Receives the most recent SMS message (implementation may vary).
checkPermissions()NoneFuture<bool>Checks if SMS permissions are granted.
requestPermissions()NoneFuture<void>Requests SMS permissions from the user.

⚠️ Permissions

Ensure the following permissions are declared in your Android AndroidManifest.xml:

<uses-permissionandroid:name="android.permission.SEND_SMS"/>
<uses-permissionandroid:name="android.permission.RECEIVE_SMS"/>
<uses-permissionandroid:name="android.permission.READ_SMS"/>
<uses-permissionandroid:name="android.permission.READ_PHONE_STATE"/>

📬 Support & Contact

If you have any issues or suggestions, feel free to reach out to me:


About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages