Skip to content

Commit 5cee39b

Browse files
committed
home-automation: Add Android support
1 parent 339a2e0 commit 5cee39b

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.github/workflows/nightly_snapshot.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ jobs:
674674
run: cargo apk build -p usecases --target aarch64-linux-android --lib --release
675675
- name: Build material gallery
676676
run: cargo apk build -p material-gallery --target aarch64-linux-android --lib --release
677+
- name: Build home automation demo
678+
run: cargo apk build -p home-automation --target aarch64-linux-android --lib --release
677679
- name: "upload APK artifact"
678680
uses: actions/upload-artifact@v4
679681
with:
@@ -685,3 +687,4 @@ jobs:
685687
target/release/apk/usecases_lib.apk
686688
target/release/apk/usecases_lib.apk
687689
target/release/apk/slint_material.apk
690+
target/release/apk/home_automation_lib.apk

demos/home-automation/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ path = "lib.rs"
1919
name = "home_automation_lib"
2020

2121
[dependencies]
22-
slint = { path = "../../../api/rs/slint" }
22+
slint = { path = "../../../api/rs/slint", features = ["backend-android-activity-06"] }
2323
chrono = "0.4"
2424

2525
[features]

demos/home-automation/rust/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ pub fn main() {
4848

4949
app.run().expect("AppWindow::run() failed");
5050
}
51+
52+
#[cfg(target_os = "android")]
53+
#[unsafe(no_mangle)]
54+
fn android_main(android_app: slint::android::AndroidApp) {
55+
slint::android::init(android_app).unwrap();
56+
main();
57+
}

0 commit comments

Comments
 (0)