Coder Social home page Coder Social logo

robius-android-env's Introduction

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:

robius-android-env's People

Contributors

kevinaboos avatar tsoutsman avatar

Stargazers

 avatar

Watchers

Edward Tan avatar  avatar

robius-android-env's Issues

Overlap with `ndk-context`?

The ecosystem already has a crate that serves the (as it seems) exact same purpose: https://crates.io/crates/ndk-context. Any reason that isn't used?

Besides, we made the wrong choice in ndk-context that an Activity is a global singleton, and it looks like this crate is making the same mistake.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.