Megosztás a következőn keresztül:


TelephonyCallback.IServiceStateListener.OnServiceStateChanged Method

Definition

Callback invoked when device service state changes on the registered subscription.

[Android.Runtime.Register("onServiceStateChanged", "(Landroid/telephony/ServiceState;)V", "GetOnServiceStateChanged_Landroid_telephony_ServiceState_Handler:Android.Telephony.TelephonyCallback/IServiceStateListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=31)]
public void OnServiceStateChanged (Android.Telephony.ServiceState serviceState);
[<Android.Runtime.Register("onServiceStateChanged", "(Landroid/telephony/ServiceState;)V", "GetOnServiceStateChanged_Landroid_telephony_ServiceState_Handler:Android.Telephony.TelephonyCallback/IServiceStateListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=31)>]
abstract member OnServiceStateChanged : Android.Telephony.ServiceState -> unit

Parameters

serviceState
ServiceState
Attributes

Remarks

Callback invoked when device service state changes on the registered subscription. Note, the registration subscription ID comes from TelephonyManager object which registers TelephonyCallback by TelephonyManager#registerTelephonyCallback(Executor, TelephonyCallback). If this TelephonyManager object was created with TelephonyManager#createForSubscriptionId(int), then the callback applies to the subscription ID. Otherwise, this callback applies to SubscriptionManager#getDefaultSubscriptionId().

The instance of ServiceState passed as an argument here will have various levels of location information stripped from it depending on the location permissions that your app holds. Only apps holding the Manifest.permission#ACCESS_FINE_LOCATION permission will receive all the information in ServiceState, otherwise the cellIdentity will be null if apps only holding the Manifest.permission#ACCESS_COARSE_LOCATION permission. Network operator name in long/short alphanumeric format and numeric id will be null if apps holding neither android.Manifest.permission#ACCESS_FINE_LOCATION

Java documentation for android.telephony.TelephonyCallback.ServiceStateListener.onServiceStateChanged(android.telephony.ServiceState).

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