Android Black Loading Screen for 20 seconds

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

Android Black Loading Screen for 20 seconds

Post by William Jamieson » Tue Nov 25, 2014 6:07 pm

I created an APK for Android that takes 20 seconds from opening the app to seeing the first screen and I am curious as to what can be done to minimize that wait time to 2 or 3 seconds.

I have tried minimizing the preOpenStack, openStack, and the preOpenCard handlers as noted here
--set the fullscreenMode of me to a modified version of "showall"

Code: Select all

on preOpenStack
   put "true" into sAppStart --Will get canceled upon the first open card
   
   if the environment is "mobile" then
      MobileSetAllowedOrientations "portrait"
   end if
   
   set the defaultfolder to the engine folder
end preOpenStack

on OpenStack
   ##TODO activate when launched
   --send "CheckPendingNotifications" to me in 15 seconds
   send "BeginSession" to me in 50 milliseconds
end OpenStack

on PreOpenCard
   put the width of this stack into gWidth
   put gWidth * 0.04 into gGap
   ##Clear variables
   put empty into field "Password Field" of me
   put empty into pPass
   put empty into aUserRecord
   put empty into gPrevCard --Will pass opencard then log this card as the first entry

   set the cSlideLoc of me to the loc of grp "Keyboard Slide" of me
   set the icon of btn "Facebook Login Button" of me to 1058 --Light blue fb button
end PreOpenCard

Do you guys have any ideas to reduce the loading time?

-Will
Last edited by William Jamieson on Wed Dec 10, 2014 6:36 am, edited 1 time in total.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Android Black Loading Screen for 20 seconds

Post by jacque » Thu Nov 27, 2014 12:37 am

The syntax for fullscreenMode should be:

Code: Select all

set the fullscreenMode of me to "showall"
See if that helps. (I'm assuming "me" is the stack script.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

Re: Android Black Loading Screen for 20 seconds

Post by William Jamieson » Thu Nov 27, 2014 7:52 am

Haha srry I should have wrote that outside the code brackets. That was a note. Yes the fullscreenmode is "showall" and works fine. Thank you Jacque.

William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

Re: Android Black Loading Screen for 20 seconds

Post by William Jamieson » Thu Dec 11, 2014 7:42 am

****SOLVED*****

Yeah! I found a really good solution for this problem for any future readers...

Have your main stack, but dont deploy it. If you can, put the login screen or the first shown screen (besides the splash screen) in a separate stack and load what is neceesary for that screen first. Then create another stack with only an object or two on it as a splash screen. Use the standalone application settings on the splash screen stack to set permissions, include icons, include necessary folders and files and the other stacks of course!

Then use a script like this to go to the next card

Code: Select all

command initializeLogin
   set the itemDel to "/"
   put item 1 to -2 of (the fileName of this stack) into tLibraryPath
   put "/Login.livecode" after tLibraryPath ## MODIFY TO MATCH YOUR PATHING
   if there is not a file tLibraryPath then
      answer "The Login SDK is missing. Please use the LiveCloud Manager to export your SDK."
   else
      start using stack tLibraryPath
      go to card "login" of stack "Login"
   end if
end initializeLogin

On my galaxy S3, I loaded the splash screen in 3 sec, I connected the database in 9 seconds and I loaded the main stack in 3 seconds. This looks a lot better for user flow too. Hope this helps!

Post Reply