From 229ef10fcfba15ad3050af9266aca8f2c2012448 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Sat, 15 Jun 2024 14:51:09 +0200 Subject: [PATCH] feat(android): add moveToBackground method (#14009) --- .../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 e5905f249d4..b6d6db771df 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 @@ -337,6 +337,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 da74d51c6f0..ef1be7069d2 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.