diff --git a/cargo-apk/injected-glue/ffi.rs b/cargo-apk/injected-glue/ffi.rs index 9c143e1..53da54e 100644 --- a/cargo-apk/injected-glue/ffi.rs +++ b/cargo-apk/injected-glue/ffi.rs @@ -73,6 +73,7 @@ pub const MODE_UNKNOWN: i32 = 0; // pub type Asset = AAsset; +pub type NativeActivityType = *const ANativeActivity; pub type NativeWindowType = *const ANativeWindow; // diff --git a/cargo-apk/injected-glue/lib.rs b/cargo-apk/injected-glue/lib.rs index d0bfa16..eec3810 100644 --- a/cargo-apk/injected-glue/lib.rs +++ b/cargo-apk/injected-glue/lib.rs @@ -32,6 +32,11 @@ extern { #[doc(hidden)] pub mod ffi; +#[no_mangle] +pub unsafe extern fn cargo_apk_injected_glue_get_native_activity() -> *const c_void { + get_native_activity() as *const _ +} + #[no_mangle] pub unsafe extern fn cargo_apk_injected_glue_get_native_window() -> *const c_void { get_native_window() as *const _ diff --git a/glue/src/lib.rs b/glue/src/lib.rs index bd1d891..81fb155 100644 --- a/glue/src/lib.rs +++ b/glue/src/lib.rs @@ -1,6 +1,7 @@ #![cfg(target_os = "android")] extern { + fn cargo_apk_injected_glue_get_native_activity() -> *const c_void; fn cargo_apk_injected_glue_get_native_window() -> *const c_void; fn cargo_apk_injected_glue_add_sender(sender: *mut ()); fn cargo_apk_injected_glue_add_sender_missing(sender: *mut ()); @@ -117,6 +118,12 @@ pub fn add_sender_missing(sender: Sender) { } } +/// Returns a handle to the native activity. +#[inline] +pub unsafe fn get_native_activity() -> *const c_void { + cargo_apk_injected_glue_get_native_activity() +} + /// Returns a handle to the native window. #[inline] pub unsafe fn get_native_window() -> *const c_void {