共用方式為


TelephonyManager.ServiceState Property

Definition

Returns the current ServiceState information.

public virtual Android.Telephony.ServiceState? ServiceState { [Android.Runtime.Register("getServiceState", "()Landroid/telephony/ServiceState;", "GetGetServiceStateHandler", ApiSince=26)] get; }
[<get: Android.Runtime.Register("getServiceState", "()Landroid/telephony/ServiceState;", "GetGetServiceStateHandler", ApiSince=26)>]
member this.ServiceState : Android.Telephony.ServiceState

Property Value

Attributes

Remarks

Returns the current ServiceState information.

If this object has been created with #createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultSubscriptionId()

If you want continuous updates of service state info, register a PhoneStateListener via #listen with the PhoneStateListener#LISTEN_SERVICE_STATE event.

Requires Permission: android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE or that the calling app has carrier privileges (see #hasCarrierPrivileges) and android.Manifest.permission#ACCESS_COARSE_LOCATION. May return null when the subscription is inactive or when there was an error communicating with the phone process.

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

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