Skip to content

rmcluster/android-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Llama RPC Android App

Runs discovery thread to ping the server on regular intervals (health + availability) + launches a child process which runs the GGML backend w/ specified number of threads (for easier interruption).

Build and Install Instructions

Prerequisites

  • Android Studio + JDK (tested w/ JDK 21)
  • Android SDK + platform-tools (adb, tested w/ 36) + NDK + CMake

Install Android Studio, then install SDK/NDK/CMake packages via the Setup Wizard or SDK Manager.

Check with:

java -version
adb version

Build + install debug APK

cd android-app
./gradlew assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apk

Components

Java-side

  • app/src/main/java/com/llama/rpcapp/MainActivity.java

    • Owns user input UI (host/port/discovery/threads) and start/stop actions.
    • Loads saved values on screen open.
    • Persists edited values only when user taps Start.
    • Starts/stops RpcServerService.
  • app/src/main/java/com/llama/rpcapp/ServerConfig.java

    • Config model shared by UI/repository/service.
    • Normalizes config values (like host and discovery IP formatting).
  • app/src/main/java/com/llama/rpcapp/SettingsRepository.java

    • SharedPreferences-backed persistence.
    • loadConfig() reads app config from XML.
    • saveConfig() writes app config to XML.
  • app/src/main/java/com/llama/rpcapp/RpcServerService.java

    • Foreground service and runtime owner for server execution.
    • Loads config from SettingsRepository at startup.
    • Chooses an available RPC port and writes resolved config back to storage.
    • Launches native RPC binary (librpc-server.so) via ProcessBuilder.
    • Streams native process output to logcat.
    • Runs discovery announce loop to tracker.
    • Stops the child process when the user taps Stop Server.
  • app/src/main/java/com/llama/rpcapp/NativeRpcServer.java

    • JNI wrapper exposing getMaxSize() for native backend capacity probes; discovery now uses Android runtime memory estimates.

C++/Native components

  • app/src/main/cpp/native-lib.cpp

    • JNI implementation for app-process native helpers (getMaxSize() only right now).
  • app/src/main/cpp/rpc-server-main.cpp

    • Standalone C++ entrypoint for the RPC server process.
  • app/src/main/cpp/CMakeLists.txt

    • Builds both native outputs:
      • llama-rpc (JNI library used inside app process)
      • rpc-server (server binary packaged as launchable .so)

Logical Flow

  1. User edits values in MainActivity UI and taps Start.
  2. MainActivity saves config to SharedPreferences through SettingsRepository.
  3. RpcServerService starts in foreground mode and loads saved config.
  4. Service resolves an available listening port and writes resolved config back.
  5. Service launches librpc-server.so via ProcessBuilder.
  6. Native rpc-server-main.cpp initializes GGML backend and enters RPC serve loop.
  7. Discovery thread sends periodic tracker announces including:
    • host/IP, service port, device model, estimated usable RAM, battery, temperature.
  8. On stop/destroy, service interrupts discovery loop and destroys child process.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors