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:
Sub Activity_Pause(UserClosed As Boolean)
if starter.Notified And UserClosed then B4XPages.ClosePageAndRemove(Me) ' or something like that ...
End Sub
You are right, I think I manage that case the wrong way, my fault...
B4X:
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.
OK, I found a way to go back to my previous activity (before notification click):
B4X:
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