Hi all,
within my B4X App I'm using "[B4X] [B4XPages] Splash Screen" by @Erel (https://www.b4x.com/android/forum/threads/b4x-b4xpages-splash-screen.120851/)
I'm using it to take time while in the background I download the data from the server (using HttpJob .download(url)) which then go to the app cache.
In this way, the user waits only x seconds (fixed time that I set for the app splash) for the app to start and then during use the data display is practically instantaneous (because the data is already in the cache).
The code within my App Main (B4A) is:
HOW IT WORKS NOW
The splash screen is displayed always: on the first app run and when the app is restored (already open) from the android task manager.
In this case (app is already open) the data is already within the app cache and I don't need to display the 6 seconds spash screen and force the user to wait when the data is already available (.download runs on the app start).
WHAT I NEED
I need that the 6 seconds splash screen runs ONLY when the app start for the first time (when I need to download the data from server).
Which is the best way to implement this mod ?
1) Checking the "FirstTime" boolean flag ?
2) Or checking if the app cache (maps) has been populated (n. items >0) ?
Thanks in advance for your help
Luca.
within my B4X App I'm using "[B4X] [B4XPages] Splash Screen" by @Erel (https://www.b4x.com/android/forum/threads/b4x-b4xpages-splash-screen.120851/)
I'm using it to take time while in the background I download the data from the server (using HttpJob .download(url)) which then go to the app cache.
In this way, the user waits only x seconds (fixed time that I set for the app splash) for the app to start and then during use the data display is practically instantaneous (because the data is already in the cache).
The code within my App Main (B4A) is:
B4X:
Sub Activity_Create(FirstTime As Boolean)
'B4XPages Splash
Activity.LoadLayout("Splash")
imgLogo.SetBitmap(xui.LoadBitmapResize(File.DirAssets, "logo.png", imgLogo.Width, imgLogo.Height, True))
Sleep(6000) '---> I need about 6 seconds in order to donwload data from server
StartActivity(actB4XSplash)
Activity.Finish
End Sub
HOW IT WORKS NOW
The splash screen is displayed always: on the first app run and when the app is restored (already open) from the android task manager.
In this case (app is already open) the data is already within the app cache and I don't need to display the 6 seconds spash screen and force the user to wait when the data is already available (.download runs on the app start).
WHAT I NEED
I need that the 6 seconds splash screen runs ONLY when the app start for the first time (when I need to download the data from server).
Which is the best way to implement this mod ?
1) Checking the "FirstTime" boolean flag ?
2) Or checking if the app cache (maps) has been populated (n. items >0) ?
Thanks in advance for your help
Luca.