# External Sdcard Access

## Prerequisites

* Android version 10 or above and termux installed.
* A PC with [<mark style="color:orange;">`android-platform-tools`</mark>](https://developer.android.com/studio/releases/platform-tools) installed. or any **adb OTG** app, is REQUIRED.
* Also, device must be connected to pc and ready for [usb debugging](https://developer.android.com/studio/debug/dev-options#enable)

{% hint style="warning" %}
It requires API LEVEL 29+, so it will not work for devices with android 9 or below.

only Android versions ( 11, 12, 13 ) are tested and working fine
{% endhint %}

## Process

{% hint style="info" %}
Assuming the user has already configured platform tools and adb in pc and connected device successfully.
{% endhint %}

### Granting permissions to termux

This method involves granting permission `WRITE_EXTERNAL_STORAGE` and `READ_EXTERNAL_STORAGE` to termux app with adb explicitly, so that termux access external storage.

```bash
adb shell pm grant com.termux android.permission.READ_EXTERNAL_STORAGE
adb shell pm grant com.termux android.permission.WRITE_EXTERNAL_STORAGE
```

Then you need to find out the external sdcard location to change the directory. this can be done via df Usually, all storage devices are mounted under \`/storage\` directory, so using this

```bash
df | grep /storage | cut -d "/" -f 4-
```

It will show all mounted at `/storage`. Now the one which is in pattern line \`716D-83Z0\` is your sdcard. Or you could use Zarchiver instead to find it's codename. Then change your directory to there and bingo you're on your external storage in termux.


---

# 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://docs.udroid.org/udroid-landing/tips-and-tricks/external-sdcard-access.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.
