Sdílet prostřednictvím


TelephonyManager.CallState Property

Definition

Returns the state of all calls on the device.

public virtual Android.Telephony.CallState CallState { [Android.Runtime.Register("getCallState", "()I", "GetGetCallStateHandler")] [Android.Runtime.RequiresPermission("android.permission.READ_PHONE_STATE")] get; }
[<get: Android.Runtime.Register("getCallState", "()I", "GetGetCallStateHandler")>]
[<get: Android.Runtime.RequiresPermission("android.permission.READ_PHONE_STATE")>]
member this.CallState : Android.Telephony.CallState

Property Value

the current call state.

Attributes

Remarks

Returns the state of all calls on the device.

This method considers not only calls in the Telephony stack, but also calls via other android.telecom.ConnectionService implementations.

Note: The call state returned via this method may differ from what is reported by PhoneStateListener#onCallStateChanged(int, String), as that callback only considers Telephony (mobile) calls.

Requires Permission: android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE for applications targeting API level 31+.

This member is deprecated. Use #getCallStateForSubscription to retrieve the call state for a specific telephony subscription (which allows carrier privileged apps), TelephonyCallback.CallStateListener for real-time call state updates, or TelecomManager#isInCall(), which supplies an aggregate "in call" state for the entire device.

Java documentation for android.telephony.TelephonyManager.getCallState().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to