Serge Bertet Active Member Licensed User Longtime User Jul 15, 2022 #1 Hi all, an easy question but no way to find an answer ... When the user receive a notification and clicks on it the app jumps in an activity. This breaks the normal cycle of activities. Is there a way to remove this activity from the stack? B4X: Copy Sub Activity_Pause(UserClosed As Boolean) if starter.Notified And UserClosed then B4XPages.ClosePageAndRemove(Me) ' or something like that ... End Sub Thank you. Serge. Last edited: Jul 15, 2022
Hi all, an easy question but no way to find an answer ... When the user receive a notification and clicks on it the app jumps in an activity. This breaks the normal cycle of activities. Is there a way to remove this activity from the stack? B4X: Copy Sub Activity_Pause(UserClosed As Boolean) if starter.Notified And UserClosed then B4XPages.ClosePageAndRemove(Me) ' or something like that ... End Sub Thank you. Serge.
Alexander Stolte Expert Licensed User Longtime User Jul 15, 2022 #2 You can't remove a B4XPage from the stack, the only thing that works is to close a page B4XPages.ClosePage(Me) Upvote 0
You can't remove a B4XPage from the stack, the only thing that works is to close a page B4XPages.ClosePage(Me)
Serge Bertet Active Member Licensed User Longtime User Jul 15, 2022 #3 Alexander Stolte said: B4XPages.ClosePage(Me) Click to expand... Really bad news This has the same effect as the user click on back button I suppose. Upvote 0
Alexander Stolte said: B4XPages.ClosePage(Me) Click to expand... Really bad news This has the same effect as the user click on back button I suppose.
Alexander Stolte Expert Licensed User Longtime User Jul 15, 2022 #4 Exactly, but why is that a problem? Upvote 0
Serge Bertet Active Member Licensed User Longtime User Jul 15, 2022 #5 Alexander Stolte said: Exactly, but why is that a problem? Click to expand... You are right, I think I manage that case the wrong way, my fault... Code: Copy Private Sub Activity_KeyPress(KeyCode As Int) As Boolean 'Return True to consume the event If KeyCode = KeyCodes.KEYCODE_BACK Then StartActivity(Main) ' I should not do that, just close the current activity Return True End If Return False End Sub Thank you to point that ... sometimes your are looking for problem where there is no. Upvote 0
Alexander Stolte said: Exactly, but why is that a problem? Click to expand... You are right, I think I manage that case the wrong way, my fault... Code: Copy Private Sub Activity_KeyPress(KeyCode As Int) As Boolean 'Return True to consume the event If KeyCode = KeyCodes.KEYCODE_BACK Then StartActivity(Main) ' I should not do that, just close the current activity Return True End If Return False End Sub Thank you to point that ... sometimes your are looking for problem where there is no.
Alexander Stolte Expert Licensed User Longtime User Jul 15, 2022 #6 Serge Bertet said: StartActivity(Main) ' I should not do that, just close the current activity Click to expand... You should not do this with B4XPages in general, because there is only 1 main activity in B4A which is already open. Upvote 0
Serge Bertet said: StartActivity(Main) ' I should not do that, just close the current activity Click to expand... You should not do this with B4XPages in general, because there is only 1 main activity in B4A which is already open.
Serge Bertet Active Member Licensed User Longtime User Jul 15, 2022 #7 OK, I found a way to go back to my previous activity (before notification click): B4X: Copy Private Sub Activity_KeyPress(KeyCode As Int) As Boolean 'Return True to consume the event If KeyCode = KeyCodes.KEYCODE_BACK Then Activity.Finish Return True ' don't know if needed End If Return False ' don't know if needed End Sub without this sub the back button does nothing. Upvote 0
OK, I found a way to go back to my previous activity (before notification click): B4X: Copy Private Sub Activity_KeyPress(KeyCode As Int) As Boolean 'Return True to consume the event If KeyCode = KeyCodes.KEYCODE_BACK Then Activity.Finish Return True ' don't know if needed End If Return False ' don't know if needed End Sub without this sub the back button does nothing.