carlbertmx
New Member
"Hi Erel and community,
I'm implementing a registration flow in a B4A B4XPages project. I want to ensure that the B4XPages environment only initializes after a successful registration/login process handled by an external Activity (act_Registration).My current approach in Main Activity:
- In Activity_Resume, I check a global flag AppRegistered.
- If False, I call StartActivity(act_Registration) and Return.
- If True, I initialize B4XPagesManager (if not initialized) and delegate the rest of the life cycle.
- I handle the UI and logic.
- Upon success, I set Main.AppRegistered = True and call Activity.Finish.
- I also use Return True in Activity_KeyPress (KeyCodes.KEYCODE_BACK) to force the user to stay in the registration flow.
- Is this the recommended way to "gatekeep" B4XPages initialization?
- Are there any side effects regarding the BackStack or the B4XPages life cycle by delaying B4XPagesManager.Initialize this way?
- In Main, I'm using moveTaskToBack(true) via JavaObject on the Back key to keep the app alive instead of closing it. Is this compatible with B4XPages internal navigation?