搜尋套件、儲存庫與 APP 分類

GitHub 儲存庫andreamainella98/phone_state

phone_state

Flutter 插件

phone_state 專案封面
星標
12
分支
28
最近推送(UTC)
2026年7月15日
專案狀態
未封存

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

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.

PAY ATTENTION

  • In the iOS simulator doesn't work
  • 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.

Buy Me A Coffee

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.

dependencies:
  flutter:
    sdk: flutter
  phone_state: 4.0.1
Android: Added permission on manifest
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />

READ_PHONE_STATE is required. READ_CALL_LOG is optional and only needed for caller phone numbers.

Warning: Adding READ_CALL_LOG permission, your app will be removed from the Play Store if you don't have a valid reason to use it. Read more.

iOS: Not needed permissions on info.plist

HOW TO USE

Get stream phone state status
StreamBuilder<PhoneState>(
  stream: PhoneState.stream,
  ...
Troubleshooting package conflicts

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.

Andrea Mainella GitHub avatar
GitHub 作者

Andrea Mainella ↗

Hi guys, I'm Andrea and I'm a Full Stack Developer in Turin (Italy).

Syncroweb SRLTurin官方網站 ↗
語言KotlinSwiftDartRubyObjective-C

此儲存庫發佈的套件

使用的依賴

依賴清單 4 項

如何選擇適合專案的儲存庫?

先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。

  1. 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
  2. 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
  3. 使用前在 GitHub 確認 README、授權條款與 Issues。

來源與維護

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗