mirror of
https://github.com/rust-mobile/android-activity.git
synced 2026-07-04 05:47:26 +00:00
57b5192366
This updates both the examples to Gradle 9 and AGP 9.1 The examples are identical, except that `na-mainloop` is based on NativeActivity and the `agdk-mainloop` based on GameActivity. The examples demonstrate: - Using the `jni` API to define enough bindings to be able to send a Toast - Using an `android_on_create` entry point for logging initialization and JNI initialization - Using `AndroidApp::run_on_java_main_thread()` to send a toast from the Java main / UI thread - Running an `android_main` event loop, including printing historic pointer samples (a new 0.6.1 feature) The examples support two input actions: - Lifting your finger in the top-left corner of the screen will show the onscreen keyboard - Lifting your finger in the top-right corner of the screen will hide the onscreen keyboard If you edit and disable `configChanges` in `AndroidManifest.xml` then these examples can also demonstrate that `android-activity` gracefully handles repeated `Activity` create -> run -> destroy cycles.
192 lines
6.6 KiB
TOML
192 lines
6.6 KiB
TOML
[package]
|
|
name = "na-mainloop"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
|
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
|
|
[dependencies]
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = [
|
|
"fmt",
|
|
"env-filter",
|
|
"tracing-log",
|
|
] }
|
|
paranoid-android = "0.2"
|
|
tracing-log = "0.2"
|
|
|
|
android-activity = { path = "../../android-activity", features = [
|
|
"native-activity",
|
|
] }
|
|
jni = "0.22"
|
|
|
|
[lib]
|
|
#name="na_mainloop"
|
|
crate-type = ["cdylib"]
|
|
|
|
####################
|
|
# cargo apk config #
|
|
####################
|
|
|
|
[package.metadata.android]
|
|
# Specifies the package property of the manifest.
|
|
package = "com.github.rust_mobile.namainloop"
|
|
|
|
# Specifies the array of targets to build for.
|
|
build_targets = ["aarch64-linux-android"]
|
|
|
|
# Path to your application's resources folder.
|
|
# If not specified, resources will not be included in the APK.
|
|
#resources = "path/to/resources_folder"
|
|
|
|
# Path to the folder containing your application's assets.
|
|
# If not specified, assets will not be included in the APK.
|
|
#assets = "path/to/assets_folder"
|
|
|
|
# Name for final APK file.
|
|
# Defaults to package name.
|
|
#apk_name = "myapp"
|
|
|
|
# Folder containing extra shared libraries intended to be dynamically loaded at runtime.
|
|
# Files matching `libs_folder/${android_abi}/*.so` are added to the apk
|
|
# according to the specified build_targets.
|
|
#runtime_libs = "path/to/libs_folder"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/uses-sdk-element
|
|
#
|
|
# Defaults to a `min_sdk_version` of 23 and `target_sdk_version` of 30 (or lower if the detected NDK doesn't support this).
|
|
[package.metadata.android.sdk]
|
|
min_sdk_version = 31
|
|
target_sdk_version = 35
|
|
#max_sdk_version = 35
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/uses-feature-element
|
|
#
|
|
# Note: there can be multiple .uses_feature entries.
|
|
[[package.metadata.android.uses_feature]]
|
|
name = "android.hardware.vulkan.level"
|
|
required = true
|
|
version = 1
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/uses-permission-element
|
|
#
|
|
# Note: there can be multiple .uses_permission entries.
|
|
#[[package.metadata.android.uses_permission]]
|
|
#name = "android.permission.WRITE_EXTERNAL_STORAGE"
|
|
#max_sdk_version = 18
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/queries-element#provider
|
|
#[[package.metadata.android.queries.provider]]
|
|
#authorities = "org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker"
|
|
# Note: The `name` attribute is normally not required for a queries provider, but is non-optional
|
|
# as a workaround for aapt throwing errors about missing `android:name` attribute.
|
|
# This will be made optional if/when cargo-apk migrates to aapt2.
|
|
#name = "org.khronos.openxr"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/queries-element#intent
|
|
#[[package.metadata.android.queries.intent]]
|
|
#actions = ["android.intent.action.SEND"]
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/queries-element#intent
|
|
# Note: there can be several .data entries.
|
|
#[[package.metadata.android.queries.intent.data]]
|
|
#mime_type = "image/jpeg"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/queries-element#package
|
|
#[[package.metadata.android.queries.package]]
|
|
#name = "org.freedesktop.monado.openxr_runtime.in_process"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/application-element
|
|
#[package.metadata.android.application]
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/application-element#debug
|
|
#
|
|
# Defaults to false.
|
|
#debuggable = false
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/application-element#theme
|
|
#
|
|
# Example shows setting the theme of an application to fullscreen.
|
|
#theme = "@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"
|
|
|
|
# Virtual path your application's icon for any mipmap level.
|
|
# If not specified, an icon will not be included in the APK.
|
|
#icon = "@mipmap/ic_launcher"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/application-element#label
|
|
#
|
|
# Defaults to the compiled artifact's name.
|
|
label = "NativeActivity Mainloop"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/meta-data-element
|
|
#
|
|
# Note: there can be several .meta_data entries.
|
|
# Note: the `resource` attribute is currently not supported.
|
|
#[[package.metadata.android.application.meta_data]]
|
|
#name = "com.samsung.android.vr.application.mode"
|
|
#value = "vr_only"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/activity-element
|
|
[package.metadata.android.application.activity]
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/activity-element#nm
|
|
#
|
|
# The name of the class that implements the activity, a subclass of Activity
|
|
#
|
|
# Defaults to "android.app.NativeActivity"
|
|
# name = "android.app.MyActivity"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/activity-element#config
|
|
#
|
|
# Defaults to "orientation|keyboardHidden|screenSize".
|
|
#config_changes = "orientation"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/activity-element#label
|
|
#
|
|
# Defaults to the application's label.
|
|
#label = "Activity Name"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/activity-element#lmode
|
|
#
|
|
# Defaults to "standard".
|
|
#launch_mode = "singleTop"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/activity-element#screen
|
|
#
|
|
# Defaults to "unspecified".
|
|
#orientation = "landscape"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/activity-element#exported
|
|
#
|
|
# Unset by default, or "true" when targeting Android >= 31 (S and up).
|
|
#exported = "true"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/meta-data-element
|
|
#
|
|
# Note: there can be several .meta_data entries.
|
|
# Note: the `resource` attribute is currently not supported.
|
|
#[[package.metadata.android.application.activity.meta_data]]
|
|
#name = "com.oculus.vr.focusaware"
|
|
#value = "true"
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/intent-filter-element
|
|
#
|
|
# Note: there can be several .intent_filter entries.
|
|
#[[package.metadata.android.application.activity.intent_filter]]
|
|
# See https://developer.android.com/guide/topics/manifest/action-element
|
|
#actions = ["android.intent.action.VIEW", "android.intent.action.WEB_SEARCH"]
|
|
# See https://developer.android.com/guide/topics/manifest/category-element
|
|
#categories = ["android.intent.category.DEFAULT", "android.intent.category.BROWSABLE"]
|
|
|
|
# See https://developer.android.com/guide/topics/manifest/data-element
|
|
#
|
|
# Note: there can be several .data entries.
|
|
# Note: not specifying an attribute excludes it from the final data specification.
|
|
#[[package.metadata.android.application.activity.intent_filter.data]]
|
|
#scheme = "https"
|
|
#host = "github.com"
|
|
#port = "8080"
|
|
#path = "/rust-windowing/android-ndk-rs/tree/master/cargo-apk"
|
|
#path_prefix = "/rust-windowing/"
|
|
#mime_type = "image/jpeg"
|