M Mike1970 Well-Known Member Licensed User Longtime User May 29, 2024 #1 Hi everyone, I'm developing a Kiosk App. I set the app to go in Immersive Mode, however it is still possible for the user to show the android navigation and status bars… since it must be a kiosk app I do not want to have any android UI in it... is it possible to permanently hide the navigation and status bar while executing my app? Thanks in advance
Hi everyone, I'm developing a Kiosk App. I set the app to go in Immersive Mode, however it is still possible for the user to show the android navigation and status bars… since it must be a kiosk app I do not want to have any android UI in it... is it possible to permanently hide the navigation and status bar while executing my app? Thanks in advance
DonManfred Expert Licensed User Longtime User May 29, 2024 #2 Mike1970 said: is it possible to permanently hide the navigation and status bar while executing my app? Click to expand... not that i know of. Upvote 0
Mike1970 said: is it possible to permanently hide the navigation and status bar while executing my app? Click to expand... not that i know of.
William Lancee Well-Known Member Licensed User Longtime User May 29, 2024 #3 This link explains why: https://developer.android.com/design/ui/mobile/guides/layout-and-content/immersive-content However, you can gain more control over the consequence of the user swiping to get out of immersive. Using the example in Immersive Mode In Main add this B4X: Copy 'In Process_Globals add ' Private lostImmersion As Boolean Sub Activity_Touch(action As Int, X As Float, Y As Float) If action = 1 And lostImmersion = True Then Swipe If lostImmersion Then Return If action = 2 And Y < 100 Or Y > Activity.Height - 100 Then lostImmersion = True End Sub Sub Swipe B4XPages.MainPage.Swipe lostImmersion = False End Sub In B4XMainPage add B4X: Copy Public Sub Swipe Dim sf As Object = xui.Msgbox2Async("Leave App?", "Warning", "Yes", "", "No", Null) Wait For (sf) Msgbox_Result (Result As Int) If Result = xui.DialogResponse_Positive Then ExitApplication End If End Sub By the time the user responds, the Activity is back in immersive! And the principle of User control is maintained. Upvote 0
This link explains why: https://developer.android.com/design/ui/mobile/guides/layout-and-content/immersive-content However, you can gain more control over the consequence of the user swiping to get out of immersive. Using the example in Immersive Mode In Main add this B4X: Copy 'In Process_Globals add ' Private lostImmersion As Boolean Sub Activity_Touch(action As Int, X As Float, Y As Float) If action = 1 And lostImmersion = True Then Swipe If lostImmersion Then Return If action = 2 And Y < 100 Or Y > Activity.Height - 100 Then lostImmersion = True End Sub Sub Swipe B4XPages.MainPage.Swipe lostImmersion = False End Sub In B4XMainPage add B4X: Copy Public Sub Swipe Dim sf As Object = xui.Msgbox2Async("Leave App?", "Warning", "Yes", "", "No", Null) Wait For (sf) Msgbox_Result (Result As Int) If Result = xui.DialogResponse_Positive Then ExitApplication End If End Sub By the time the user responds, the Activity is back in immersive! And the principle of User control is maintained.
M Mike1970 Well-Known Member Licensed User Longtime User May 29, 2024 #4 William Lancee said: This link explains why: https://developer.android.com/design/ui/mobile/guides/layout-and-content/immersive-content However, you can gain more control over the consequence of the user swiping to get out of immersive. Using the example in Immersive Mode In Main add this B4X: Copy 'In Process_Globals add ' Private lostImmersion As Boolean Sub Activity_Touch(action As Int, X As Float, Y As Float) If action = 1 And lostImmersion = True Then Swipe If lostImmersion Then Return If action = 2 And Y < 100 Or Y > Activity.Height - 100 Then lostImmersion = True End Sub Sub Swipe B4XPages.MainPage.Swipe lostImmersion = False End Sub In B4XMainPage add B4X: Copy Public Sub Swipe Dim sf As Object = xui.Msgbox2Async("Leave App?", "Warning", "Yes", "", "No", Null) Wait For (sf) Msgbox_Result (Result As Int) If Result = xui.DialogResponse_Positive Then ExitApplication End If End Sub By the time the user responds, the Activity is back in immersive! And the principle of User control is maintained. Click to expand... Actually i'm looking for the opposite. While my app is shown I do not want the navigation bar and status bar to be visible, even if the user swipes-up Upvote 0
William Lancee said: This link explains why: https://developer.android.com/design/ui/mobile/guides/layout-and-content/immersive-content However, you can gain more control over the consequence of the user swiping to get out of immersive. Using the example in Immersive Mode In Main add this B4X: Copy 'In Process_Globals add ' Private lostImmersion As Boolean Sub Activity_Touch(action As Int, X As Float, Y As Float) If action = 1 And lostImmersion = True Then Swipe If lostImmersion Then Return If action = 2 And Y < 100 Or Y > Activity.Height - 100 Then lostImmersion = True End Sub Sub Swipe B4XPages.MainPage.Swipe lostImmersion = False End Sub In B4XMainPage add B4X: Copy Public Sub Swipe Dim sf As Object = xui.Msgbox2Async("Leave App?", "Warning", "Yes", "", "No", Null) Wait For (sf) Msgbox_Result (Result As Int) If Result = xui.DialogResponse_Positive Then ExitApplication End If End Sub By the time the user responds, the Activity is back in immersive! And the principle of User control is maintained. Click to expand... Actually i'm looking for the opposite. While my app is shown I do not want the navigation bar and status bar to be visible, even if the user swipes-up
William Lancee Well-Known Member Licensed User Longtime User May 29, 2024 #5 Yes that's what this does. Start with the Immersion Example Immersive Mode. Modify as I showed. It starts in immersive mode. When the user swipes (top or bottom), it detects that and intercedes with a message. That message could be anything. For example "don't do that" (not recommended) or what I suggested: an option to exit the App (since it is an immersive only App). You'll see that the immersive mode is back by the time the user replies. I have attached the example. Attachments ImmersPlus.zip ImmersPlus.zip 14.6 KB · Views: 443 Upvote 0
Yes that's what this does. Start with the Immersion Example Immersive Mode. Modify as I showed. It starts in immersive mode. When the user swipes (top or bottom), it detects that and intercedes with a message. That message could be anything. For example "don't do that" (not recommended) or what I suggested: an option to exit the App (since it is an immersive only App). You'll see that the immersive mode is back by the time the user replies. I have attached the example.
William Lancee Well-Known Member Licensed User Longtime User May 29, 2024 #6 Here are some alternative messages: "Swiping from top or from bottom of screen has no effect in this App" or "This App will restart" or "Press Ok to continue" Neither will give the user an opportunity to exit the App without powering off. Hopefully this is not their personal device Use Wait For after the message invocation. Upvote 0
Here are some alternative messages: "Swiping from top or from bottom of screen has no effect in this App" or "This App will restart" or "Press Ok to continue" Neither will give the user an opportunity to exit the App without powering off. Hopefully this is not their personal device Use Wait For after the message invocation.
M Mike1970 Well-Known Member Licensed User Longtime User May 29, 2024 #7 William Lancee said: Yes that's what this does. Click to expand... I already tried... the immersive mode works (I followed the tutorial I linked), but when I Swipe Up the navigation bar and status bar are temporary showed anyway and the same happens with your example, even if the msgbox is shown. (see attached image) Status bar seems to be gone only because there is a MsgBox showed... but I cannot use a MsgBox William Lancee said: Neither will give the user an opportunity to exit the App without powering off. Click to expand... I already prevent the user to exit from the application by putting it in KIOSK MODE. The goal is not this, but is to NOT show any type of bar of Android, neither when swiping up, nothing must happen. William Lancee said: Hopefully this is not their personal device Click to expand... No ?, the app will run on a dedicated device Upvote 0
William Lancee said: Yes that's what this does. Click to expand... I already tried... the immersive mode works (I followed the tutorial I linked), but when I Swipe Up the navigation bar and status bar are temporary showed anyway and the same happens with your example, even if the msgbox is shown. (see attached image) Status bar seems to be gone only because there is a MsgBox showed... but I cannot use a MsgBox William Lancee said: Neither will give the user an opportunity to exit the App without powering off. Click to expand... I already prevent the user to exit from the application by putting it in KIOSK MODE. The goal is not this, but is to NOT show any type of bar of Android, neither when swiping up, nothing must happen. William Lancee said: Hopefully this is not their personal device Click to expand... No ?, the app will run on a dedicated device
William Lancee Well-Known Member Licensed User Longtime User May 29, 2024 #8 Never permanently hide system bars on personal devices. You cannot permanently hide system bars in your app unless for an Android Enterprise deployment, so your designs should account for them to provide the optimal experience. Read more about designing for system bars. Click to expand... but I cannot use a MsgBox Click to expand... Then the only solution seems to be an Android Enterprise deployment, which I know nothing about. Upvote 0
Never permanently hide system bars on personal devices. You cannot permanently hide system bars in your app unless for an Android Enterprise deployment, so your designs should account for them to provide the optimal experience. Read more about designing for system bars. Click to expand... but I cannot use a MsgBox Click to expand... Then the only solution seems to be an Android Enterprise deployment, which I know nothing about.
William Lancee Well-Known Member Licensed User Longtime User May 29, 2024 #9 By the way on my Tablet the status bars show only for a half second flash (a blink of the eye), before the message appears. Upvote 0
By the way on my Tablet the status bars show only for a half second flash (a blink of the eye), before the message appears.
M Mike1970 Well-Known Member Licensed User Longtime User May 29, 2024 #10 William Lancee said: Android Enterprise deployment Click to expand... oh no... I never knew about this... Upvote 0
William Lancee said: Android Enterprise deployment Click to expand... oh no... I never knew about this...
William Lancee Well-Known Member Licensed User Longtime User May 29, 2024 #11 For those still interested, there here is another fairly innocuous message that works to keep the App immersive. Replace the Swipe sub in attachment #5 with B4X: Copy Public Sub Swipe Dim jo As JavaObject = xui.Msgbox2Async("Please Wait", "", "", "", "", Null) Sleep(800) jo.RunMethod("cancel", Null) End Sub Or even B4X: Copy Public Sub Swipe Dim jo As JavaObject = xui.Msgbox2Async("Not a valid swipe", "", "", "", "", Null) Sleep(200) jo.RunMethod("cancel", Null) End Sub Just being creative. If the theme color of MsgboxAsync is set to transparent, you can (untested) do this. The only thing you'll see is a very brief flash of the navigation bar before it disappears. B4X: Copy Public Sub Swipe Dim jo As JavaObject = xui.Msgbox2Async("", "", "", "", "", Null) Sleep(10) jo.RunMethod("cancel", Null) End Sub Upvote 0
For those still interested, there here is another fairly innocuous message that works to keep the App immersive. Replace the Swipe sub in attachment #5 with B4X: Copy Public Sub Swipe Dim jo As JavaObject = xui.Msgbox2Async("Please Wait", "", "", "", "", Null) Sleep(800) jo.RunMethod("cancel", Null) End Sub Or even B4X: Copy Public Sub Swipe Dim jo As JavaObject = xui.Msgbox2Async("Not a valid swipe", "", "", "", "", Null) Sleep(200) jo.RunMethod("cancel", Null) End Sub Just being creative. If the theme color of MsgboxAsync is set to transparent, you can (untested) do this. The only thing you'll see is a very brief flash of the navigation bar before it disappears. B4X: Copy Public Sub Swipe Dim jo As JavaObject = xui.Msgbox2Async("", "", "", "", "", Null) Sleep(10) jo.RunMethod("cancel", Null) End Sub