Skip to content

Latest commit

 

History

History
 
 

sample-tor-compose

ABOUT:

I spend lot of time trying to implement Tor Network inside an android app and finally I got it working. I thought this might help someone else out there.

So this project uses kotlin instead of java and also using the emerging compose jetpack.

What is this app?

This app is a proof of concept for Tor Network in android app in a simple web browser app.

How does it work?

By clicking the Connect button, the app will start and bind TorService.

After the Tor Service started, we can start browsing with Tor Network with entering the URL inside the textfield. Hitting the reload button will then trigger state change and update the webView which uses GenericWebViewClient to intercept the connection and use Tor instead.

IDE:

  • Android Studio

LANGUAGE:

  • Kotlin

STEP:

  • create new project with compose activity template

  • add dependency to gradle

    implementation 'info.guardianproject:tor-android:0.4.7.8'
    implementation 'info.guardianproject:jtorctl:0.4.5.7'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
  • add permission to manifest

    <uses-permission android:name="android.permission.INTERNET" />
  • copy GenericWebViewClient from link to app/src/main/java/torcompose/com/ then modify to use kotlin and update package name

  • edit MainActivity.kt

SCREENSHOTS:

  • image

  • image