Android Question Help converting code to B4xPages

ProjectGroup19

Active Member
Licensed User
Greetings Everyone,
I am trying to get familiar with b4xpages. I have read and watched some tutorials but i still need a little push. I have this old app which i'm trying to convert to b4xpages. Once i get how to start, i will be able to continue.

This is how i implemented it,
I used a KeyValueStore, stored in the Starter, to store some contents . The app starts with a splash screen, whiles checking for remote connection in the background.

If connection is unsuccessful, display a message using the default message dialog which closes/ends the app upon tapping on the button.
If connection is successful, it checks if the KeyValueStore content. If empty navigate to the login screen else go to the dashboard.

'1. Create a [splash screen] with a timer whiles checking the [connection] in the background.
'2. If [connection] is [NotSuccessful], exit the app'
'3. If [connection] is [Successful], Check if the user has saved credentials.
'4. If [No], start the [Login] module.
'5. If [Yes], but is [NotApproved] start the [Login] module.
'6. If [Yes] and [Approved], start the [Dashboard] module.


Attached is a sample created from the orginal.
 

Attachments

  • Test.zip
    10.2 KB · Views: 80
Last edited:

ProjectGroup19

Active Member
Licensed User
@Erel Thank you but i'm familiar with the splash screen example. What i'm not familiar with is, checking the stored values in the KeyValueStore which is in the Starter Service. and the logout which i used to use the code to close all activities. Thus with b4xpages.
B4X:
'CLOSE ALL ACTIVITY-----------------------------
    Dim jo As JavaObject
    jo.InitializeContext
    jo.RunMethod("finishAffinity", Null)
 
Upvote 0

ProjectGroup19

Active Member
Licensed User
Don't use the starter service.

Move KVS to B4XMainPage.
You can access it from any page using B4XPages.MainPage.KVS (make sure that it is a public variable).

You don't need the finishAffinity call.
I think this insight is what I needed. I will give it a try. Thanks again @Erel
 
Upvote 0
Top