Page 1 of 1

Android Black Loading Screen for 20 seconds

Posted: Tue Nov 25, 2014 6:07 pm
by William Jamieson
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

Re: Android Black Loading Screen for 20 seconds

Posted: Thu Nov 27, 2014 12:37 am
by jacque
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.)

Re: Android Black Loading Screen for 20 seconds

Posted: Thu Nov 27, 2014 7:52 am
by William Jamieson
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.

Re: Android Black Loading Screen for 20 seconds

Posted: Thu Dec 11, 2014 7:42 am
by William Jamieson
****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!