v3.0.1phone_state
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.
Flutter plugin
{"sdk":"flutter"}^1.19.1{"sdk":"flutter"}^6.0.0English project snapshot. Visit GitHub for the latest content.
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.
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.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.Note: This version requires Flutter >= 3.44.0 and Dart >= 3.12.2. Add
phone_stateto your app'spubspec.yaml, not to this package'spubspec.yaml. Your app/package name must be different fromphone_state.
dependencies:
flutter:
sdk: flutter
phone_state: 4.0.1
<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_LOGpermission, your app will be removed from the Play Store if you don't have a valid reason to use it. Read more.
StreamBuilder<PhoneState>(
stream: PhoneState.stream,
...
If phone_state stops receiving updates after adding another package:
READ_PHONE_STATE is required, and READ_CALL_LOG is only needed for caller phone numbers.PhoneState.stream listener for each app flow. Cancel the previous subscription before starting another one when screens, services, or background handlers change.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.