Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 2.1 KB

README.md

File metadata and controls

46 lines (33 loc) · 2.1 KB

Psiphon Library for Android README

Overview

Psiphon Library for Android enables you to easily embed Psiphon in your Android app. The Psiphon Library for Android is implemented in Go and follows the standard conventions for using a Go library in an Android app.

Status

  • Pre-release

Building From Source

Follow Go Android documentation:

  • gomobile documentation
  • Requires Go 1.5 or later.
  • Build command: gomobile bind -target=android github.com/Psiphon-Labs/psiphon-tunnel-core/AndroidLibrary/psi
  • Output: psi.aar

Using

  1. Build psi.aar from source or use the binary release
  2. Add psi.aar to your Android Studio project as described in the gomobile documentation
  3. Example usage in Psibot sample app

See sample API usage in Psibot's PsiphonVpn.java. Uses gobind conventions for data passing.

  1. Embed a config file
  2. Call Go.init(getApplicationContext()); in Application.onCreate()
  3. Extend Psi.Listener.Stub to receive messages in Message(String line)
  4. Call Psi.Start(configFile, Psi.Listener) to start Psiphon. Catch Exception to receive errors.
  5. Call Psi.Stop() to stop Psiphon.
  6. Sample shows how to monitor messages and detect which proxy ports to use and when the tunnel is active.

NOTE: may add more explicit interface for state change events.

Limitations

  • Only supports one concurrent instance of Psiphon.