I am developing new android app which should use tor network. First I think it would be easy, just download Orbot and configure it to route my app to tor network. Then I realize that I couldn't do that without root privileges. I could do that if I configure example wifi network use localhost and 8118, but then it will route all traffic and Orbot should be running too. I just want to set up my app to use TOR with Orbot so is it possible without root privileges? Any help will be priceless!
Properly implement SOCKS5 in your app (by properly I meanusing remote hostname lookup otherwise you risk the possibility of leaking DNS), this by default runs on port 9050 (on localhost).
Orbot also provides an HTTP proxy on port 8118, but I think you should prefer SOCKS5. (It's simpler and less likely to break in unexpected ways).
Well, first of all - you need any Tor instance, either Orbot or the statically compiled-in one, and you don't need any root privileges! If you're making an application that should be able to utilize Tor's privacy - make sure to implement SOCKS5s, not just SOCKS5 - the
s letter means DNS resolving through SOCKS proxy. Nowdays - if you have just a web application - you can easily utilize Tor's built-in HTTPS proxy via standard libraries as well.
About the root privileges: even the root level does not prevent the leaks : check the tcpdump when the device is booting, for example... These privileges are needed to execute the
iptables - either a built-in or a shipped one - to make a diversion rules work, but it's not a guarantee that it will safeguard you: any root-enabled app can mangle these rules or add it's own ones....