Go to file
Kevin Boos 5ddab0a2ce
Merge pull request #2 from tsoutsman/fnonce
Replace `Fn` with `FnOnce` in API
2024-05-29 08:41:16 -07:00
src Replace `Fn` with `FnOnce` in API 2024-05-29 20:12:43 +10:00
.gitignore Initial commit 2024-04-14 09:10:11 +10:00
Cargo.lock Add support for any UI toolkit compatible with `ndk-context` 2024-05-28 13:17:47 -07:00
Cargo.toml improve docs 2024-05-28 14:13:47 -07:00
LICENSE-MIT Add MIT license 2024-05-20 14:51:34 -07:00
README.md improve docs 2024-05-28 14:13:47 -07:00

README.md

robius-android-env

Latest Version Docs Project Robius Matrix Chat

This crate provides easy Rust access to Android state (native Java objects) managed by UI toolkits.

Usage of this crate

This crate exists for two kinds of downstream users:

  1. The UI toolkit that exposes its key internal states that hold the current Android activity being displayed and the Java VM / JNI environment. Either the UI toolkit or the app itself should set these states on startup, either by using ndk-context or by manually calling the set_vm() and set_activity_getter() functions.
  2. The platform feature "middleware" crates that need to access the current activity and JNI environment from Rust code in order to interact with the Android platform.

Supported UI toolkits

  • Makepad: enable the makepad Cargo feature.
  • UI toolkits compatible with ndk-context: enable the ndk_context Cargo feature.
  • Others coming soon! (in the meantime, see below)

Usage of this crate for other UI toolkits

⚠️ Note: for wider compatibility, you should prefer the ndk-context feature instead of what is described below.

For any other UI toolkits not listed above, you don't need to enable any cargo features. Instead, your application code must manually provide two key states:

  • a reference to the current Android activity.
  • a reference to the current Java VM instance (and JNI environment).

This can be achieved by doing the following: