Expand description
Minimal helper for jni-rs, supporting dynamic proxies, Android dex embedding,
permission request and broadcast receiver. Used for calling Java code from Rust.
Version 0.4.x of this crate can be used with jni 0.22.x.
This crate uses ndk_context::AndroidContext on Android, usually initialized
by android_activity. Examples for Android are provided in the crate page.
Please make sure you are viewing documentation generated for your target.
Structs§
- Broadcast
Receiver - Handles
android.content.BroadcastReceiverobject backed byJniProxy. - Broadcast
Waiter - Waits for intents received by the managed
BroadcastReceiver. - Dynamic
Proxy - Java dynamic proxy with an invocation handler backed by the Rust closure.
- Intent
- A
android.content.Intentreference, tied to a JNI local reference frame. - Intent
Filter - A
android.content.IntentFilterreference, tied to a JNI local reference frame. - JBoolean
- A
java.lang.Booleanreference, tied to a JNI local reference frame. - JByte
- A
java.lang.Bytereference, tied to a JNI local reference frame. - JCharacter
- A
java.lang.Characterreference, tied to a JNI local reference frame. - JDouble
- A
java.lang.Doublereference, tied to a JNI local reference frame. - JFloat
- A
java.lang.Floatreference, tied to a JNI local reference frame. - JInteger
- A
java.lang.Integerreference, tied to a JNI local reference frame. - JLong
- A
java.lang.Longreference, tied to a JNI local reference frame. - JMethod
- A
java.lang.reflect.Methodreference, tied to a JNI local reference frame. - JNumber
- A
java.lang.Numberreference, tied to a JNI local reference frame. - JShort
- A
java.lang.Shortreference, tied to a JNI local reference frame. - Permission
Request - Android runtime permission request utility.
Traits§
- DexClass
Loader - Provides DEX class loading support for Android.
Functions§
- android_
api_ level - Gets the API level (SDK version) of the current Android OS.
- android_
app_ cache_ dir - Returns the absolute path to the application specific cache directory.
- android_
app_ files_ dir - Returns the absolute path to the directory holding application files. No permissions are required for the calling app to read or write files under the returned path.
- android_
app_ name - Gets the raw name of the current Android application, parsed from the package name.
- android_
app_ package_ name - Gets the package name of the current Android application.
- android_
context - Gets the current
android.content.Contextfrom ndk_context, usually a reference ofandroid.app.Applicationorandroid.app.NativeActivity. Please check the completed issue https://github.com/rust-mobile/android-activity/issues/228 if you had expected a reference of an activity to be returned by this function. - block_
with_ timeout - Convenient blocker for asynchronous functions, based on
futures_liteandfutures_timer. Warning: Blocking in theandroid_main()thread will block the future’s completion if it depends on event processing in this thread (check your glue crate likeandroid_activity). - jni_
get_ vm - Try to get the
JavaVMfromjni::JavaVM::singleton, otherwise it gets theJavaVMfrom thendk_contextcrate. - jni_
with_ env - Calls jni_get_vm, attaches the current thread to the JVM and executes the closure; The thread may stay attached even if it has not been attached previously.