makepad-android-state 0.9.0

Exposes access to Makepad's context states on Android
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 8.08 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.11 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • makepad/makepad
    6196 314 94
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • makepaddev

makepad-android-state

This crate is responsible for holding Makepad's Android-specific context states. It exists solely to allow external crates to access those Android states without depending on the entirety of Makepad.

These two states are:

  1. The JavaVM instance initialized by the JNI layer.
  • This cannot be set by foreign code outside this crate, as it is only ever set once during the lifetime of the app process.
  1. The current Makepad Activity instance.
  • This can be set by foreign code outside this crate, as the underlying Android platform may tear down and reconstruct the activity instance multiple times during the app's lifetime.
  • However, for safety reasons, we only permit a single caller to obtain the private "set_activity" function, which ensures that only the internal Makepad framework can set the activity instance.

Usage

Note: you probably want to use the robius-android-env crate instead of using this crate directly, or an even higher-level crate that depends on robius-android-env.

External users of this crate should only care about two functions:

  1. get_java_vm(): returns a pointer to the JavaVM instance, through which you can obtain the JNI environment.
  2. get_activity(): returns a pointer to the current Makepad Activity instance.

All other functions are intended for Makepad-internal use only, and will not be useful for external users.