phone_state 패키지는 Android 및 iOS 기기에서 수신 중인 전화를 감지하고 통화 상태를 모니터링하는 간단한 방법을 제공합니다. 이 플러그인은 전화가 오는 순간 앱이 동적으로 반응할 수 있게 해주며, 미디어 재생 일시 정지 또는 앱 동작 조정과 같은 작업을 수행할 수 있습니다. 플러그인은 최소한의 설정으로 네이티브 디바이스 API를 활용하여 실시간 통화 상태 업데이트를 제공합니다. 음악 플레이어, 메시징 앱, 또는 통화 중에 적응해야 하는 생산성 도구와 같이 통화 이벤트를 인식해야 하는 애플리케이션에 이상적입니다.
사용 사례
incoming calls 감지
통화 중 미디어 일시 정지
통화 중 앱 동작 조정
실시간으로 통화 상태 모니터링
전화 인식 기능과의 통합
주요 기능
실시간 통화 상태 감지
크로스 플랫폼 지원 (Android 및 iOS)
최소 구성
네이티브 API 통합
경량이고 효율적
적합한 대상
미디어 재생 앱
생산성 도구
메시징 애플리케이션
전화 기능 통합 서비스
통화 이벤트 인식이 필요한 앱
고려 사항
두 플랫폼 모두 적절한 권한이 필요합니다
통화 상태에 국한됨, 완전한 전화 제어는 불가능
백그라운드 실행 처리가 필요할 수 있습니다
Android와 iOS 간의 동작이 약간 다릅니다
통화 발신 또는 관리에 적합하지 않음
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
DESCRIPTION
This plugin allows you to know quickly and easily if your Android or iOS device is receiving a call and to know the status of the call.
The caller phone number is only available on Android, not iOS
This plugin reports phone call state only. It does not answer, reject, end, or record calls, and it does not change whether other packages can capture call audio.
Android detects system telephony call state only. Third-party VoIP calls from apps such as Telegram or WhatsApp are not supported. iOS CallKit behavior can differ by app.
The iOS implementation uses CallKit. For apps distributed in regions where CallKit is restricted, including China App Store review contexts, confirm availability and territory rules with Apple before submission.
PhoneState.stream requires the app process to be running with an active Flutter engine and listener. It does not send callbacks after the app is terminated.
On Android, if PhoneState.stream does not emit, confirm READ_PHONE_STATE is declared and granted at runtime. Some OEM battery or background restrictions, including MIUI settings on Xiaomi devices, can also delay or block callbacks.
HOW TO INSTALL
Flutter
Note: This version requires Flutter >= 3.44.0 and Dart >= 3.12.2.
Add phone_state to your app's pubspec.yaml, not to this package's pubspec.yaml. Your app/package name must be different from phone_state.
If phone_state stops receiving updates after adding another package:
Confirm the required Android runtime permissions are granted before listening. READ_PHONE_STATE is required, and READ_CALL_LOG is only needed for caller phone numbers.
Keep a single active PhoneState.stream listener for each app flow. Cancel the previous subscription before starting another one when screens, services, or background handlers change.
When reporting a conflict, include the other package names, platform versions, a minimal reproduction, and the relevant Flutter, Logcat, or Xcode logs.
SCREENSHOT
Write me in the GitHub issues the new features you need and, if they are approved of course, I will implement them as soon as I can.