TelephonyManager.DataEnabled Property

Definition

Returns whether mobile data is enabled or not per user setting. -or- Values used to return status for hasCarrierPrivileges call.

public virtual bool DataEnabled { [Android.Runtime.Register("isDataEnabled", "()Z", "GetIsDataEnabledHandler", ApiSince=26)] get; [Android.Runtime.Register("setDataEnabled", "(Z)V", "GetSetDataEnabled_ZHandler", ApiSince=26)] [Android.Runtime.RequiresPermission("android.permission.MODIFY_PHONE_STATE")] set; }
[<get: Android.Runtime.Register("isDataEnabled", "()Z", "GetIsDataEnabledHandler", ApiSince=26)>]
[<set: Android.Runtime.Register("setDataEnabled", "(Z)V", "GetSetDataEnabled_ZHandler", ApiSince=26)>]
[<set: Android.Runtime.RequiresPermission("android.permission.MODIFY_PHONE_STATE")>]
member this.DataEnabled : bool with get, set

Property Value

true if mobile data is enabled.

Attributes

Remarks

Property getter documentation:

Returns whether mobile data is enabled or not per user setting. There are other factors that could disable mobile data, but they are not considered here.

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

Requires one of the following permissions: android.Manifest.permission#ACCESS_NETWORK_STATE, android.Manifest.permission#MODIFY_PHONE_STATE, or android.Manifest.permission#READ_BASIC_PHONE_STATE READ_BASIC_PHONE_STATE or that the calling app has carrier privileges (see #hasCarrierPrivileges).

Note that this does not take into account any data restrictions that may be present on the calling app. Such restrictions may be inspected with ConnectivityManager#getRestrictBackgroundStatus.

Java documentation for android.telephony.TelephonyManager.isDataEnabled().

Property setter documentation:

Values used to return status for hasCarrierPrivileges call.

Java documentation for android.telephony.TelephonyManager.setDataEnabled(boolean).

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