PhoneStateListener.OnServiceStateChanged(ServiceState) 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.
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.
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.