TelephonyManager.IsDataEnabledForReason(Int32) Method

Definition

Return whether data is enabled for certain reason .

[Android.Runtime.Register("isDataEnabledForReason", "(I)Z", "GetIsDataEnabledForReason_IHandler", ApiSince=31)]
public virtual bool IsDataEnabledForReason (int reason);
[<Android.Runtime.Register("isDataEnabledForReason", "(I)Z", "GetIsDataEnabledForReason_IHandler", ApiSince=31)>]
abstract member IsDataEnabledForReason : int -> bool
override this.IsDataEnabledForReason : int -> bool

Parameters

reason
Int32

the reason the data enable change is taking place

Returns

whether data is enabled for a reason. <p>Requires Permission: The calling app has carrier privileges (see #hasCarrierPrivileges) or android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE or android.Manifest.permission#ACCESS_NETWORK_STATE or android.Manifest.permission#MODIFY_PHONE_STATEandroid.Manifest.permission#READ_BASIC_PHONE_STATE

Attributes

Remarks

Return whether data is enabled for certain reason .

If #isDataEnabledForReason returns false, it means in data enablement for a specific reason is turned off. If any of the reason is off, then it will result in bypassing user preference and result in data to be turned off. Call #isDataConnectionAllowed in order to know whether data connection is allowed on the device.

If this object has been created with #createForSubscriptionId, applies to the given subId. Otherwise, applies to SubscriptionManager#getDefaultDataSubscriptionId()

Java documentation for android.telephony.TelephonyManager.isDataEnabledForReason(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.

Applies to