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

패키지 상세v1.0.7

sms_sender_background

이중 SIM 카드, 권한 처리 및 다중 부분 메시지 지원을 위한 SMS 메시지 전송용 플러터 플러그인입니다.

Android
30일 다운로드
54
좋아요
15
Pub 점수
160

패키지 설치

flutter pub add sms_sender_background

패키지 개요

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

sms_sender_background는 안드로이드에서 SMS 메시지를 전송하기 위해 설계된 플러터 플러그인으로, 듀얼 SIM 카드 지원, 자동 권한 처리 및 다중 부분 메시지 전달을 제공합니다. 백그라운드 프로세스에서 원활한 SMS 기능을 가능하게 하여 사용자 개입 없이 신뢰할 수 있는 메시지 전송이 필요한 애플리케이션에 적합합니다. 이 플러그인은 안드로이드의 통화 API와 원활하게 통합되며, 메시지 분할 및 SIM 선택과 같은 복잡한 상황을 관리합니다. 자동 또는 스케줄된 SMS 알림이 필요한 앱에 특히 유용합니다.

사용 사례

  • 자동 SMS 알림
  • 더블 SIM 메시지 라우팅
  • 백그라운드 SMS 전달
  • 스케줄된 메시지
  • 다중 부분 SMS 지원
  • SMS 기반 인증

주요 기능

  • 듀얼 SIM 카드 지원
  • 자동 권한 관리
  • 다중 부분 메시지 처리
  • 백그라운드 실행 기능
  • SIM 선택 제어
  • 안드로이드 전용 호환성

적합한 대상

  • 자동 SMS가 필요한 앱
  • 알림 시스템
  • 이중 인증
  • 현장 서비스 애플리케이션
  • 메시징 유틸리티
  • 백그라운드 작업 통합

고려 사항

  • Android 전용 플랫폼
  • 런타임 권한이 필요합니다
  • SMS 기능에 제한됨
  • iOS 지원 없음
  • 기기의 전화 기능에 따라 다릅니다
  • 이중 SIM 장치에 대해 추가 구성이 필요할 수 있습니다

원본 README

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

SMS Sender Background

A Flutter plugin for sending SMS messages with support for dual SIM cards, permission handling, and multi-part messages.

Features

  • Send SMS messages from your Flutter app
  • Support for dual SIM cards (specify SIM slot)
  • Automatic permission handling (request and check SMS permissions)
  • Support for long messages (automatically splits into multi-part messages)
  • Error handling and status reporting

Getting Started

Installation

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

dependencies:
  sms_sender_background: ^1.0.5
Android Setup

Add the following permissions to your Android Manifest (android/app/src/main/AndroidManifest.xml):

<uses-permission android:name="android.permission.SEND_SMS"/>
<!-- Optional: Required only for dual SIM support -->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

Note about READ_PHONE_STATE permission:

  • This permission is optional and only needed if you want to use dual SIM functionality
  • If not granted, the plugin will automatically fall back to using the default SIM card
  • This ensures the plugin works reliably even on devices with stricter security policies or when distributed outside Google Play
Usage
import 'package:sms_sender_background/sms_sender.dart';;

// Create an instance
final smsSender = SmsSender();

// Check SMS permission
bool hasPermission = await smsSender.checkSmsPermission();

// Request permission if needed
if (!hasPermission) {
  hasPermission = await smsSender.requestSmsPermission();
}

// Optional: Check and request READ_PHONE_STATE permission for dual SIM support
// If not granted, the plugin will use the default SIM card
bool hasPhoneStatePermission = await smsSender.checkPhoneStatePermission();
if (!hasPhoneStatePermission) {
  hasPhoneStatePermission = await smsSender.requestPhoneStatePermission();
}

// Send SMS
if (hasPermission) {
  try {
    bool success = await smsSender.sendSms(
      phoneNumber: '+1234567890',
      message: 'Hello from Flutter!',
      simSlot: 0, // Optional: specify SIM slot (0 or 1)
    );
    print('SMS sent: $success');
  } catch (e) {
    print('Error sending SMS: $e');
  }
}

Additional Features

Dual SIM Support

To send an SMS using a specific SIM card:

// Optional: Request READ_PHONE_STATE permission for dual SIM support
bool hasPhoneStatePermission = await smsSender.checkPhoneStatePermission();
if (!hasPhoneStatePermission) {
  hasPhoneStatePermission = await smsSender.requestPhoneStatePermission();
}

await smsSender.sendSms(
  phoneNumber: '+1234567890',
  message: 'Hello!',
  simSlot: 1, // Use second SIM card
);

Important Notes:

  • Dual SIM support requires the READ_PHONE_STATE permission
  • If this permission is not granted, the plugin will automatically fall back to using the default SIM card
  • This ensures compatibility across all devices, including those with stricter security policies
  • The fallback mechanism works reliably even when apps are installed from unknown sources
Long Messages

The plugin automatically handles long messages by splitting them into multiple parts:

await smsSender.sendSms(
  phoneNumber: '+1234567890',
  message: 'A very long message that will be automatically split...',
);

Error Handling

The plugin provides detailed error information through exceptions:

  • PlatformException with code "PERMISSION_DENIED" when SMS permission is not granted
  • PlatformException with code "INVALID_ARGUMENT" when phone number or message is empty
  • PlatformException with code "SMS_SEND_ERROR" when SMS sending fails

Contributing

Feel free to contribute to this project:

  1. Fork it
  2. Create your feature branch (git checkout -b feature/my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/my-new-feature)
  5. Create a new Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details

카테고리

의존성

의존성 목록 1 개

  • plugin_platform_interface^2.0.2

소스 저장소

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

아직 데이터가 없습니다.