flutter_native_sms 0.0.6 copy "flutter_native_sms: ^0.0.6" to clipboard
flutter_native_sms: ^0.0.6 copied to clipboard

PlatformAndroid

A Flutter plugin for sending native sms. for android only

flutter_native_sms #

A Flutter plugin for sending sms and also retrieving your sim's info , and you can also choosing from which sim to send the sms. Note : this plugin works only for android. Ios is not implemented yet.

Getting Started #

  import 'package:flutter_native_sms/flutter_native_sms.dart';

To use this package import it first

Usage #

First u need to add required permissions :

    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />

you may also need to request sms permission from user with permission_handler package, or any other package.

   await Permission.sms.request();
   await Permission.phone.request();

Sending sms


 FlutterNativeSms sms =  new FlutterNativeSms();
 sms.send(
      phone:'phone number your want to send the sms',
      smsBody:'A sms text',
      sim:'0', // choose which sim you want to send the sms from, the default is 0 which means first sim, if u have dual sim you can change the value to 1 which means second sim
 );

retrieving info of your current sim's of your phone

  FlutterNativeSms sms =  new FlutterNativeSms();
  print(sms.simInfo());
// prints : 
// [
//   {
//     COUNTRY_CODE: your_country_code,
//     PHONE_NUMBER: your_phone_number,
//     CARD_ID: card_id,
//     CARRIER_NAME: you_operator_name,
//     DISPLAY_NAME: your_custom_sim_name_that_you_defined_in_your_phone,
//     SIM_SLOT_INDEX: slot_of_your_sim_number, 
//     SUBSCRIPTION_ID: subscription_id, 
//   },
// ]
0
likes
140
points
103
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for sending native sms. for android only

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_native_sms