TelephonyManager.GetServiceState(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the current ServiceState
information.
[Android.Runtime.Register("getServiceState", "(I)Landroid/telephony/ServiceState;", "GetGetServiceState_IHandler", ApiSince=33)]
public virtual Android.Telephony.ServiceState? GetServiceState (int includeLocationData);
[<Android.Runtime.Register("getServiceState", "(I)Landroid/telephony/ServiceState;", "GetGetServiceState_IHandler", ApiSince=33)>]
abstract member GetServiceState : int -> Android.Telephony.ServiceState
override this.GetServiceState : int -> Android.Telephony.ServiceState
Parameters
- includeLocationData
- Int32
Specifies if the caller would like to receive
location related information.
May return null
when the subscription is inactive or when there was an error
communicating with the phone process.
Returns
- 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.
There's another way to renounce permissions with a custom context AttributionSource.Builder#setRenouncedPermissions(Set<String>)
but only for system apps. To avoid confusion, calling this method supersede renouncing permissions with a custom context.
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
.
Java documentation for android.telephony.TelephonyManager.getServiceState(int)
.
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.