Giter Site home page Giter Site logo

App Freeze or Hang about torandroid HOT 13 CLOSED

 avatar commented on May 25, 2024
App Freeze or Hang

from torandroid.

Comments (13)

mirsamantajbakhsh avatar mirsamantajbakhsh commented on May 25, 2024

Hi.

Try start it in a background thread. Not UI thread.

from torandroid.

 avatar commented on May 25, 2024

Can You give me sample code

from torandroid.

mirsamantajbakhsh avatar mirsamantajbakhsh commented on May 25, 2024

Sample code of connection is available in README.md and AndroidTest.
https://github.com/mirsamantajbakhsh/TorAndroid/blob/main/app/src/androidTest/java/ir/mstajbakhsh/torandroid/ExampleInstrumentedTest.java

Just put that code inside an AsynchTask
https://developer.android.com/reference/android/os/AsyncTask

from torandroid.

 avatar commented on May 25, 2024

Can you Integrate My Project I will hire you

from torandroid.

mirsamantajbakhsh avatar mirsamantajbakhsh commented on May 25, 2024

I can check your code. Upload it to github and send me the repository link, but for hiring, I am busy and cannot be hired. Thanks for suggestion.

from torandroid.

 avatar commented on May 25, 2024

https://we.tl/t-Iu3BddLtKL

check this code

from torandroid.

mirsamantajbakhsh avatar mirsamantajbakhsh commented on May 25, 2024

It did not load. Would you please paste the code here as a code segment like:
sample code segment?

from torandroid.

 avatar commented on May 25, 2024

Lightning-Browser.zip

from torandroid.

mirsamantajbakhsh avatar mirsamantajbakhsh commented on May 25, 2024

I've checked the code. You have used the TorAndroid library in lightning/connect/TorConnect.java file. I've tried your code and faced an exception in library and created an issue #4 and fixed it in 3a48012

I've uploaded the library to Bintray and now it is working. Here is a sample code which will start Tor in another thread. Feel free to ask if you have another question.

    public void startTorInBackground(Context cntx) {
        HandlerThread mHandlerThread = new HandlerThread("TorThread");
        mHandlerThread.start();
        Handler mHandler = new Handler(mHandlerThread.getLooper());
        mHandler.postDelayed(() -> {
            final TorProxy tb = new TorProxy.TorBuilder()
                    .setSOCKsPort(9150)
                    .setUseBrideges(false)
                    .setDebuggable(false)
                    .build(cntx.getApplicationContext());
            tb.init();
            try {
                final IConnectionDone icd = new IConnectionDone() {
                    @Override
                    public void onSuccess() {
                        Log.d("TorAndroid", "Tor Started Successfully.");
                    }

                    @Override
                    public void onFailure(Exception ex) {
                        Log.e("TorAndroid", "Error in Starting Tor.\r\n" + ex.getMessage());
                    }
                };
                tb.start(icd);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }, 1000);
    }

from torandroid.

 avatar commented on May 25, 2024

I integrate this but when I try to use onion URL in my browser application then not working also https://check.torproject.org open not connected, please check yourself

from torandroid.

 avatar commented on May 25, 2024
public void startTorInBackground(Context cntx) {
        HandlerThread mHandlerThread = new HandlerThread("TorThread");
        mHandlerThread.start();
        Handler mHandler = new Handler(mHandlerThread.getLooper());
        mHandler.postDelayed(() -> {
            final TorProxy tb = new TorProxy.TorBuilder()
                    .setSOCKsPort(9150)
                    .setUseBrideges(false)
                    .setDebuggable(false)
                    .build(cntx.getApplicationContext());
            tb.init();
            try {
                final IConnectionDone icd = new IConnectionDone() {
                    @Override
                    public void onSuccess() {
                        Log.d("TorAndroid", "Tor Started Successfully.");
                    }

                    @Override
                    public void onFailure(Exception ex) {
                        Log.e("TorAndroid", "Error in Starting Tor.\r\n" + ex.getMessage());
                    }
                };
                tb.start(icd);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }, 1000);
    }

This Code not working, Nullpointer exception

from torandroid.

mirsamantajbakhsh avatar mirsamantajbakhsh commented on May 25, 2024

I think that you are using un-updated version of the library (May be the old version is in your Gradle's cache). However, I've released a new version both in GitHub release page and Bintray.

Update your library version to 2.0.0447 and it will be fixed.

implementation 'com.github.mirsamantajbakhsh:TorAndroid:2.0.0447'

I've checked it myself. Now it is working.

image

I've used the same code I've sent previously:
image

from torandroid.

mirsamantajbakhsh avatar mirsamantajbakhsh commented on May 25, 2024

It seems that the issue has been fixed. So I close it.

from torandroid.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.