safe_sms 0.2.7

  • Readme
  • Changelog
  • Installing
  • 65

xxhdpi

[UNMAINTAINED] This project is unmaintained #

Flutter SMS #

This is an SMS library for flutter.

It only support Android for now (I can't do it for iOS because I don't own Mac).

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

Installation and Usage #

Once you're familiar with Flutter you may install this package adding sms (0.1.4 or higher) to the dependencies list of the pubspec.yaml file as follow:

dependencies:
  flutter:
    sdk: flutter

  sms: ^0.2.0
    <uses-permission android:name="android.permission.READ_SMS"/>
    <uses-permission android:name="android.permission.SEND_SMS"/>
    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />

Then run the command flutter packages get on the console.

Querying SMS messages #

Add the import statement for sms and create an instance of the SmsQuery class:

import 'package:sms/sms.dart';

void main() {
  SmsQuery query = new SmsQuery();
}

Getting all SMS messages #

List<SmsMessage> messages = await query.getAllSms;

Note: the use of await keyword means that getAllSms is resolved asynchronously and a Future is retorned.

Filtering SMS messages #

The method querySms from the SmsQuery class returns a list of sms depending of the supplied parameters. For example, for querying all the sms messages sent and received write the followed code:

await query.querySms({
    kinds: [SmsQueryKind.Inbox, SmsQueryKind.Sent]
});

You can also query all the sms messages sent and received from a specific contact:

await query.querySms({
    address: getContactAddress()
});

Getting all Threads Conversations #

With SmsQuery you can also get the entire list of conversations:

List<SmsThread> threads = await query.getAllThreads;

Roadmap #

  • [x] SMS Receiver
  • [x] SMS Sender
  • [x] SMS Delivery
  • [x] SMS Query
  • [x] SMS Thread
  • [ ] MMS Receiver
  • [ ] MMS Sender
  • [ ] MMS Delivery
  • [ ] MMS Query
  • [ ] Multi Sim Card
  • [x] Contact
  • [x] Contact Photo (full size, thumbnail)
  • [x] User profile (basic info)

Contributors #

Designed and created by Imrul kayes

Contributions #

Any contribution is welcome.

[0.2.6] - 2020-01-21 #

  • Remove All Code but Read SMS

[0.2.5] - 2020-01-15 #

  • Remove All Permissions but Read SMS

[0.2.4] - 2018-09-30 #

  • Add fail state

[0.2.3] - 2018-09-29 #

  • Fix issue with SMS state handler

[0.2.2] - 2018-09-05 #

  • Update dart version

[0.2.1] - 2018-08-13 #

  • Fix issue with toString on error

[0.2.0] - 2018-08-09 #

  • Multi SIM card support

[0.1.6] - 2018-08-07 #

  • Fix permission error when sending SMS on Android O and above

[0.1.5] - 2018-08-06 #

  • Fix permission error on Android M and above

[0.1.4] - 2018-06-16 #

  • Error on contact lookup because of unknown size fixed

[0.1.3] - 2018-05-29 #

  • Error in Android 4.x because of missing permission 'READ_PROFILE' fixed
  • Updated Flutter environment sdk to ">=1.19.0 <2.0.0"
  • Example app code refactoring

[0.1.2] - 2018-05-26 #

  • Photo and thumbnail of a contact get loaded with the contact, no need to request them later.
  • Example app UI slightly enhanced.

[0.1.1] - 2018-05-14 #

  • Sms Delivery with Dart Streams and Event Channels
  • Fixed some minor errors
  • Fixed error on User Profile. The method 'getUserProfile()' will always return an instance of UserProfile even when no user profile configured in the device.
  • Fixed error in SmsThread.findContact when first message is a draft.

[0.1.0] - 2018-04-23 #

  • Sms Delivery

[0.0.10] - 2018-04-18 #

  • Automatically assign contact to created SmsThread
  • Small fix for 'date' and 'dateSent' of SmsMessage
  • Fixed error on multiple permissions requests
  • Get basic User Profile info.
  • Fix gradle build

[0.0.9] - 2018-03-15 #

  • backward compatibility for Contact (pull request #1 by joanpablo)

[0.0.8] - 2018-03-10 #

  • SmsReceiver creates all needed field
  • Add basic contact support

[0.0.7] - 2018-03-09 #

  • Small fix for SMS thread

[0.0.6] - 2018-03-09 #

  • Implementation of SMS thread

[0.0.5] - 2018-03-09 #

  • Support for dart < 2.0.0

[0.0.4] - 2018-03-09 #

  • Better query for SMS, now you can query by multiple kind instead of only one.

[0.0.3] - 2018-03-09 #

  • Better handling of permissions
  • Implementation of SmsQuery

[0.0.2] - 2018-03-08 #

  • Implementation of SmsSender

[0.0.1] - 2018-03-08 #

  • Implementation of SmsReceiver.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  safe_sms: ^0.2.7

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:safe_sms/generated/i18n.dart';
import 'package:safe_sms/sms.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
39
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/generated/i18n.dart.

Run flutter format to format lib/generated/i18n.dart.

Format lib/sms.dart.

Run flutter format to format lib/sms.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and safe_sms.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8