패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.2.4

sms

Flutter 애플리케이션용 SMS 라이브러리입니다. SMS 메시지 전송, 수신, SMS 전달 상태 조회 및 연락처 정보 조회를 가능하게 합니다. Flutter에서 완전히 기능하는 SMS 앱을 개발하기 위한 간편하고 친숙한 API를 제공합니다.

30일 다운로드
239
좋아요
118
Pub 점수
30

패키지 설치

flutter pub add sms

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutter용 SMS 패키지는 SMS 메시지 보내기, 받기, 조회, 전달 상태 확인 및 연락처 정보 접근을 위한 간단한 API를 제공합니다. 최소한의 설정으로 기능이 완전한 SMS 애플리케이션을 개발할 수 있게 해줍니다. 사용 편의성을 고려해 플랫폼별 복잡성을 추상화하여 안드로이드와 iOS에서 원활한 통합을 가능하게 합니다. 핵심 메시징 작업을 지원하며 신뢰할 수 있는 통신 기능을 통해 앱 기능을 강화합니다.

사용 사례

  • SMS 메시징 앱 만들기
  • 이중 인증 구현
  • 메시지 전달 자동화
  • 연락처 검색 통합
  • 메시지 전달 상태 추적
  • 알림 시스템 만들기

주요 기능

  • SMS 메시지 보내기 및 받기
  • 메시지 전달 상태 조회
  • 연락처 정보에 액세스
  • 간단하고 직관적인 API
  • 크로스 플랫폼 호환성
  • Android 및 iOS 지원

적합한 대상

  • 메시징 앱을 개발하는 개발자
  • SMS 인증이 필요한 앱
  • 자동 메시지 처리가 필요한 도구
  • 연락처와 통합된 애플리케이션
  • 신뢰할 수 있는 SMS 기능을 찾는 프로젝트

고려 사항

  • Android 및 iOS에서 적절한 권한이 필요합니다
  • 기본 SMS 작업에 제한됨
  • 백그라운드 메시지 처리를 위해 추가 구성이 필요할 수 있습니다
  • 기기 수준의 SMS 액세스에 의존함
  • 고용량 상업 메시지에는 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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

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;

Getting the Contact info

Each conversation thread is related with a Contact. The class Contact contains all the info of a thread contact (address, photo, full name). To get access to Contact class you must import 'package:sms/contact.dart' into your dart file:

import 'package:sms/contact.dart';

void main() {
  ...
  Contact contact = threads.first.contact;
  print(contact.address);
}

Querying Contact

You can also query a contact by its address (phone number):

import 'package:sms/contact.dart';

void main() {
  ContactQuery contacts = new ContactQuery();
  Contact contact = await contacts.queryContact(someAddress());
  print(contact.fullName);
}
String getAddress() {...}

The Contact photo

You can retrieve the photo of the contact (full size or thumbnail):

...
Uint8List fullSize = contact.photo.bytes;
Uint8List thumbnail = contact.thumbnail.bytes;

User Profile

Some times it is useful to request basic info of the phone owner, like the contact photo, addresses, etc.

import 'package:sms/contact.dart';

UserProfileProvider provider = new UserProfileProvider();
UserProfile profile = await provider.getUserProfile();
print(profile.fullName);

Sending SMS

What about sending a SMS? All you have to do is to create an instance of the SmsSender class:

import 'package:sms/sms.dart';

void main() {
  SmsSender sender = new SmsSender();
  String address = someAddress();
  ...
  sender.sendSms(new SmsMessage(address, 'Hello flutter!'));
}

To be notified when the message is sent and/or delivered, you must add a listener to your message:

import 'package:sms/sms.dart';

void main() {
  SmsSender sender = new SmsSender();
  String address = someAddress();
  ...
  SmsMessage message = new SmsMessage(address, 'Hello flutter!');
  message.onStateChanged.listen((state) {
    if (state == SmsMessageState.Sent) {
      print("SMS is sent!");
    } else if (state == SmsMessageState.Delivered) {
      print("SMS is delivered!");
    }
  });
  sender.sendSms(message);
}

Some times it is useful to be notified of delivered messages regardless of the message. To do that you must subscribe to the onSmsDelivered of the SmsSender class instance:

void main() {
...
SmsSender sender = new SmsSender();
sender.onSmsDelivered.listen((SmsMessage message){
  print('${message.address} received your message.');
}));
}

You can also send with another SimCard:

void main() {
SimCardsProvider provider = new SimCardsProvider();
SimCard card = await provider.getSimCards()[0];
SmsSender sender = new SmsSender();
SmsMessage message = new SmsMessage("address", "message");
sender.sendSMS(message, simCard: card);
}

Note: Using the onSmsDelivered from the SmsSender will only notify to listeners of messages that has been sent through SmsSender.send().

Receiving SMS

If you want to be notified for incoming new messages you must subscribe to an instance of the SmsReceiver class:

import 'package:sms/sms.dart';

void main() {
  SmsReceiver receiver = new SmsReceiver();
  receiver.onSmsReceived.listen((SmsMessage msg) => print(msg.body));
}

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

App logo

Designed and created by Imrul kayes

Contributions

Any contribution is welcome.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트