> For the complete documentation index, see [llms.txt](https://guide.onionmobile.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.onionmobile.dev/tor-on-android/arti-mobile-on-android.md).

# Arti Mobile on Android

Using Tor's new Rust-based runtime in your Android app

[Arti-Mobile-Ex](https://gitlab.com/guardianproject/arti-mobile-ex) is the current project for building and using the Arti (Tor in Rust) project within your mobile app. The repository is available at: <https://gitlab.com/guardianproject/arti-mobile-ex>

#### To build for Android

* install Rust and Android Studio. Make sure you can run an Hello World with both.
* go in the common folder and run `make android`.
* take a coffee, or two.
* open the android folder in Android Studio or use gradle to build your app as usual.

### Sample Project for Android

There is a [sample Android Studio project](https://gitlab.com/guardianproject/arti-mobile-ex/-/tree/main/android/sample?ref_type=heads) that demonstrates how easy it can be to use Arti within your Android app.

Once you have built and imported the Arti library into your project, all that you do to initialize it using default ports, all that you need to do is:

```
Arti.init(this);
```

From there, you can easily proxy any HTTP connection over Arti's built-in SOCKs proxy port

```
Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(proxyHost, proxyPort));

HttpURLConnection connection = null;
URL url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection(proxy);
connection.setRequestMethod("GET");
```

You can also use the ProxyConfig class to enable WebView proxying, as well

```
ProxyConfig proxyConfig = new ProxyConfig.Builder()
           .addProxyRule("127.0.0.1:8118") //http proxy for tor
          .addDirect().build();

ProxyController.getInstance().setProxyOverride(proxyConfig, new Executor() {
            @Override
            public void execute(Runnable command) {
                //do nothing
            }
        }, new Runnable() {
            @Override
            public void run() {

            }
        });

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://guide.onionmobile.dev/tor-on-android/arti-mobile-on-android.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
