TelephonyManager.SetDataEnabledForReason(Int32, Boolean) Method

Definition

Control of data connection and provide the reason triggering the data connection control.

[Android.Runtime.Register("setDataEnabledForReason", "(IZ)V", "GetSetDataEnabledForReason_IZHandler", ApiSince=31)]
[Android.Runtime.RequiresPermission("android.permission.MODIFY_PHONE_STATE")]
public virtual void SetDataEnabledForReason (int reason, bool enabled);
[<Android.Runtime.Register("setDataEnabledForReason", "(IZ)V", "GetSetDataEnabledForReason_IZHandler", ApiSince=31)>]
[<Android.Runtime.RequiresPermission("android.permission.MODIFY_PHONE_STATE")>]
abstract member SetDataEnabledForReason : int * bool -> unit
override this.SetDataEnabledForReason : int * bool -> unit

Parameters

reason
Int32

the reason the data enable change is taking place

enabled
Boolean

True if enabling the data, otherwise disabling.

        &lt;p&gt;Requires Permission:
        The calling app has carrier privileges (see <code data-dev-comment-type="c">#hasCarrierPrivileges</code>) if the reason is
        <code data-dev-comment-type="c">#DATA_ENABLED_REASON_USER</code> or <code data-dev-comment-type="c">#DATA_ENABLED_REASON_CARRIER</code> or the call app
        has <code data-dev-comment-type="c">android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE</code> irrespective of
        the reason.
Attributes

Remarks

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