Another Telephony는 원본 telephony 패키지에서 파생된 Flutter 플러그인으로, Android 앱이 통화 기능에 접근할 수 있도록 설계되었습니다. 개발자는 네트워크 정보를 가져오고, 전화 통화를 시작하며, SMS 메시지를 보내고 받을 수 있으며, 들어오는 SMS를 감지할 수 있습니다. 신뢰성 있는 수신 SMS 탐지 기능을 포함하여 실시간 SMS 상호작용이 필요한 애플리케이션에 적합합니다. Android 전용으로 제작되어 Flutter 앱에 핵심 통화 기능을 간단한 인터페이스로 통합할 수 있게 해줍니다.
사용 사례
SMS 인증 시스템
앱 내 통화 시작
실시간 수신 SMS 모니터링
네트워크 상태 추적
이중 인증
자동 메시지 처리
주요 기능
SMS 보내기 및 받기 지원
전화 통화 시작을 활성화
네트워크 정보를 가져옵니다
수신 SMS 리스너 수정
안드로이드 전용 플랫폼 지원
간단한 API 통합
적합한 대상
SMS 기반 인증을 구축하는 개발자
자동 SMS 처리가 필요한 앱
전화 액세스가 필요한 모바일 앱
Android 중심의 Flutter 프로젝트
실시간 메시징이 필요한 애플리케이션
고려 사항
Android 플랫폼에 한정
SMS 및 통화를 위한 런타임 권한이 필요합니다
수신 SMS 리스닝은 배터리에 영향을 줄 수 있습니다
기기 고유의 통화 서비스에 의존합니다
iOS와 호환되지 않음
백그라운드 실행을 위해 추가 구성이 필요할 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Telephony
We create this fork because the original package is not maintained anymore. We will try to keep this package up to date with the latest Flutter version.
:exclamation: This plugin currently only works on Android Platform
Contribute or meet a problem
Please create pull-request/issue in the original package, i will check and fix it as soon as possible.
Happy to contribute this project together :heart:
From VietNam (with Paracel & Spratly Islands) contributor
Contact me for [instantly support](mailto:dangtrongthanh1998@gmail.com)
A Flutter plugin to use telephony features such as
Send SMS Messages
Query SMS Messages
Listen for incoming SMS
Retrieve various network parameters
Start phone calls
This plugin tries to replicate some of the functionality provided by Android's Telephony class.
Check the Features section to see the list of implemented and missing features.
Although this plugin will check and ask for permissions at runtime, it is advisable to manually ask for permissions before calling any other functions.
The plugin will only request those permission that are listed in the AndroidManifest.xml.
SMS can either be sent directly or via the default SMS app.
Send SMS directly from your app:
telephony.sendSms(
to: "1234567890",
message: "May the force be with you!"
);
If you want to listen to the status of the message being sent, provide SmsSendStatusListener to the sendSms function.
finalSmsSendStatusListener listener = (SendStatus status) {
// Handle the status
};
telephony.sendSms(
to: "1234567890",
message: "May the force be with you!",
statusListener: listener
);
If the body of the message is longer than the standard SMS length limit of 160 characters, you can send a multipart SMS by setting the isMultipart flag.
Send SMS via the default SMS app:
telephony.sendSmsByDefaultApp(to: "1234567890", message: "May the force be with you!");
As of the 1.12 release of Flutter, plugins are automatically registered. This will allow you to use plugins as you normally do even in the background execution context.
Fetch various metrics such as network type, sim state, etc.
// Check if a device is capable of sending SMSbool canSendSms = await telephony.isSmsCapable;
// Get sim stateSimState simState = await telephony.simState;
If you want to call the telephony methods in background, you can do in the following ways.
1. Using only Telephony.instance
If you want to continue using Telephony.instance in the background, you will need to make sure that once the app comes back to the front, it again calls Telephony.instance.
@pragma('vm:entry-point')
backgroundMessageHandler(SmsMessage message) async {
// Handle background messageTelephony.instance.sendSms(to: "123456789", message: "Message from background")
}
voidmain() {
runApp(MyApp());
}
class_MyAppStateextendsState<MyApp> {
String _message;
// This will not work as the instance will be replaced by// the one in background.final telephony = Telephony.instance;
@overridevoidinitState() {
super.initState();
// You should make sure call to instance is made every time // app comes to foregroundfinal inbox = Telephony.instance.getInboxSms()
}
2. Use backgroundInstance
If you cannot make sure that the call to instance would be made every time app comes to foreground, or if you would prefer to maintain a separate background instance,
you can use Telephony.backgroundInstance in the background execution context.