# Enable/Disable Mobile Data API

### Permission

The application declares the following permissions in the manifest：

```xml
 android.permission.CLOUDPOS_SET_MOBILE_DATA
```

### API Overview

#### setMobileDataEnabled

{% code overflow="wrap" %}

```java
boolean setMobileDataEnabled(int slot, boolean enable);
```

{% endcode %}

Enable/Disable mobile data.

| Parameters |                                                                                                          |
| ---------- | -------------------------------------------------------------------------------------------------------- |
| slot       | slot number, 1 is slot 1, 2 is slot 2.                                                                   |
| enable     | for the mobile data setting, a boolean value is used: true enables mobile data, while false disables it. |

| Returns |                                                                                         |
| ------- | --------------------------------------------------------------------------------------- |
| boolean | <p>a boolean representation of the result.</p><p>true if success. false if failure.</p> |

#### setMobileDataRoamingEnabled

{% code overflow="wrap" %}

```java
boolean setMobileDataRoamingEnabled(int slot, int roaming);
```

{% endcode %}

Enable/Disable mobile data roaming.

| Parameters |                                                                                                                          |
| ---------- | ------------------------------------------------------------------------------------------------------------------------ |
| slot       | slot number, 1 is slot 1, 2 is slot 2.                                                                                   |
| roaming    | for the mobile data roaming setting, a boolean value is used: true enables mobile data roaming, while false disables it. |

| Returns |                                                                                         |
| ------- | --------------------------------------------------------------------------------------- |
| boolean | <p>a boolean representation of the result.</p><p>true if success. false if failure.</p> |

**Resource Download**

* Refer to the cloudpos apidemo - [demo](https://github.com/SmartPOSSamples/APIDemoForAar.git).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://smartpossdk.gitbook.io/cloudpossdk/faq/advance-sdk/enable-disable-mobile-data-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
