From 0c14835ce3459c1391019c3351052411b9f74a64 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 19 Mar 2024 12:15:51 +0100 Subject: [PATCH] feat(android): add moveToBackground method --- .../java/ti/modules/titanium/ui/android/AndroidModule.java | 5 +++++ apidoc/Titanium/UI/Android/Android.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/android/AndroidModule.java b/android/modules/ui/src/java/ti/modules/titanium/ui/android/AndroidModule.java index bc9e666347c..8602096a488 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/android/AndroidModule.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/android/AndroidModule.java @@ -328,6 +328,11 @@ public String harmonizedColor(String value) return String.format("#%06X", (0xFFFFFF & MaterialColors.harmonizeWithPrimary(TiApplication.getAppCurrentActivity(), color))); } + @Kroll.method + public void moveToBackground() + { + TiApplication.getAppRootOrCurrentActivity().moveTaskToBack(true); + } @Override public String getApiName() diff --git a/apidoc/Titanium/UI/Android/Android.yml b/apidoc/Titanium/UI/Android/Android.yml index cb0788372eb..7e97b214dc1 100644 --- a/apidoc/Titanium/UI/Android/Android.yml +++ b/apidoc/Titanium/UI/Android/Android.yml @@ -29,6 +29,11 @@ methods: type: String since: { android: "12.0.0" } + - name: moveToBackground + summary: Moves the app to the background + platforms: [android] + since: { android: "12.4.0" } + - name: hideSoftKeyboard summary: | Hides the soft keyboard.