Partager via


TelephonyManager.ActionPhoneStateChanged Field

Definition

Broadcast intent action indicating that the call state on the device has changed.

[Android.Runtime.Register("ACTION_PHONE_STATE_CHANGED")]
[Android.Runtime.RequiresPermission("android.permission.READ_PHONE_STATE")]
public const string ActionPhoneStateChanged;
[<Android.Runtime.Register("ACTION_PHONE_STATE_CHANGED")>]
[<Android.Runtime.RequiresPermission("android.permission.READ_PHONE_STATE")>]
val mutable ActionPhoneStateChanged : string

Field Value

Attributes

Remarks

Broadcast intent action indicating that the call state on the device has changed.

The #EXTRA_STATE extra indicates the new call state. If a receiving app has android.Manifest.permission#READ_CALL_LOG permission, a second extra #EXTRA_INCOMING_NUMBER provides the phone number for incoming and outgoing calls as a String.

If the receiving app has android.Manifest.permission#READ_CALL_LOG and android.Manifest.permission#READ_PHONE_STATE permission, it will receive the broadcast twice; one with the #EXTRA_INCOMING_NUMBER populated with the phone number, and another with it blank. Due to the nature of broadcasts, you cannot assume the order in which these broadcasts will arrive, however you are guaranteed to receive two in this case. Apps which are interested in the #EXTRA_INCOMING_NUMBER can ignore the broadcasts where #EXTRA_INCOMING_NUMBER is not present in the extras (e.g. where Intent#hasExtra(String) returns false). <p class="note"> This was a android.content.Context#sendStickyBroadcast sticky broadcast in version 1.0, but it is no longer sticky. Instead, use #getCallState to synchronously query the current call state.

Java documentation for android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED.

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

See also