Udostępnij za pośrednictwem


PhoneStateListener.OnServiceStateChanged(ServiceState) 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")]
public virtual void OnServiceStateChanged (Android.Telephony.ServiceState? serviceState);
[<Android.Runtime.Register("onServiceStateChanged", "(Landroid/telephony/ServiceState;)V", "GetOnServiceStateChanged_Landroid_telephony_ServiceState_Handler")>]
abstract member OnServiceStateChanged : Android.Telephony.ServiceState -> unit
override this.OnServiceStateChanged : Android.Telephony.ServiceState -> unit

Parameters

serviceState
ServiceState
Attributes

Remarks

Callback invoked when device service state changes on the registered subscription. Note, the registration subId comes from TelephonyManager object which registers PhoneStateListener by TelephonyManager#listen(PhoneStateListener, int). If this TelephonyManager object was created with TelephonyManager#createForSubscriptionId(int), then the callback applies to the subId. 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 nor android.Manifest.permission#ACCESS_COARSE_LOCATION.

This member is deprecated. Use TelephonyCallback.ServiceStateListener instead.

Java documentation for android.telephony.PhoneStateListener.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