Compartir a través de


TelephonyManager.GetCarrierRestrictionStatus(IExecutor, IConsumer) Method

Definition

Get the carrier restriction status of the device.

[Android.Runtime.Register("getCarrierRestrictionStatus", "(Ljava/util/concurrent/Executor;Ljava/util/function/Consumer;)V", "GetGetCarrierRestrictionStatus_Ljava_util_concurrent_Executor_Ljava_util_function_Consumer_Handler", ApiSince=34)]
[Android.Runtime.RequiresPermission("android.permission.READ_PHONE_STATE")]
public virtual void GetCarrierRestrictionStatus (Java.Util.Concurrent.IExecutor executor, Java.Util.Functions.IConsumer resultListener);
[<Android.Runtime.Register("getCarrierRestrictionStatus", "(Ljava/util/concurrent/Executor;Ljava/util/function/Consumer;)V", "GetGetCarrierRestrictionStatus_Ljava_util_concurrent_Executor_Ljava_util_function_Consumer_Handler", ApiSince=34)>]
[<Android.Runtime.RequiresPermission("android.permission.READ_PHONE_STATE")>]
abstract member GetCarrierRestrictionStatus : Java.Util.Concurrent.IExecutor * Java.Util.Functions.IConsumer -> unit
override this.GetCarrierRestrictionStatus : Java.Util.Concurrent.IExecutor * Java.Util.Functions.IConsumer -> unit

Parameters

executor
IExecutor

The executor on which the result listener will be called.

resultListener
IConsumer

Consumer that will be called with the result fetched from the radio of type CarrierRestrictionStatus

Attributes

Remarks

Get the carrier restriction status of the device.

To fetch the carrier restriction status of the device the calling application needs to be allowlisted to Android at here. The calling application also needs the READ_PHONE_STATE permission. The return value of the API is as follows. <ul> <li>return #CARRIER_RESTRICTION_STATUS_RESTRICTED_TO_CALLER if the caller and the device locked by the network are same</li> <li>return #CARRIER_RESTRICTION_STATUS_RESTRICTED if the caller and the device locked by the network are different</li> <li>return #CARRIER_RESTRICTION_STATUS_NOT_RESTRICTED if the device is not locked</li> <li>return #CARRIER_RESTRICTION_STATUS_UNKNOWN if the device locking state is unavailable or radio does not supports the feature</li> </ul>

Java documentation for android.telephony.TelephonyManager.getCarrierRestrictionStatus(java.util.concurrent.Executor, java.util.function.Consumer<java.lang.Integer>).

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