Let's recap:
- My splash stack is named "Referi"
- My data stack is named "ReferiTOP"
- When I test install or generate a standalone, I password protect "ReferiTOP" on the "savingMobileStandalone" message.
- MyLog messages are a internal log to help me out (save data to disk): the "Prev 2.126 s" means 2 seconds and 126 milliseconds from previous MyLog message.
- My problem is the long time the engine takes to open the password protected ReferiTOP, running in a not so fast Android 11 device.
Example one:
As suggested I passkeyed the "ReferiTOP" before opening it. The code, from the "Referi", is like this:
Code: Select all
if there is not a file sStackPath then
--just to be sure: if the stack is not in the document folder, use the stack loaded in the copy pane of standalone setting
--but this should never happens since the ReferiTOP stack, on first launch, is copied to the doc folder.
put sSourceDirectory & "Referi_/ReferiTOP.livecode" into sStackPath
end if
try
myLog "","Setting ReferiTOP passkey"
DeProtectMyStacks sStackPath
go stack sStackPath--path to the ReferiTOP stack, be it in resources or Documents
put the result into tResult
if tResult is not empty then
answer "Result of opening ReferiTOP:" && tResult
end if
catch errorVariable
MyLog "", "-----------REFERI: ERROR launching ReferiTOP" && errorVariable
end try
Code: Select all
private command DeProtectMyStacks pStackPath
try --substack must be passkeyed too
set the passkey of stack pStackPath to "XXX"
repeat for each line tSubStack in the substacks of stack pStackPath
set the passkey of stack tSubStack of stack pStackPath to "XXX"
end repeat
MyLog "","-----------ReferiTOP PassKey has been set"
catch errorVariable
MyLog "","-----------Referi ERROR: Passkey failed" && pStackPath & cr & errorVariable
end try
end DeProtectMyStacks
The result of the MyLog is the following:
2025,2,3,20,42,22,2 (Prev 0 s) = -----------REFERI: OpenStack
2025,2,3,20,42,23,2 (Prev 0.958 s) = -----------REFERI: GoReferiTOP /data/user/0/com.trevix.it.segnapunto/files/Referi_/ReferiTOP.livecode
2025,2,3,20,42,23,2 (Prev 0.001 s) = Setting passkey
2025,2,3,20,42,36,2 (Prev 12.843 s) = -----------REFERI: PassKey has been set
2025,2,3,20,42,36,2 (Prev 13.304 s) = PreOpenStack stack "/data/user/0/com.trevix.it.segnapunto/files/Referi_/ReferiTOP.livecode"
2025,2,3,20,42,36,2 (Prev 0.002 s) = Loading Prefs
As you can see, the delay is doubled (12.843 + 13.304), compared to the MyLog without the Passkey action:
2025,2,3,20,47,59,2 (Prev 0 s) = -----------REFERI: OpenStack
2025,2,3,20,48,0,2 (Prev 0.925 s) = -----------REFERI: GoReferiTOP /data/user/0/com.trevix.it.segnapunto/files/Referi_/ReferiTOP.livecode
2025,2,3,20,48,13,2 (Prev 13.072 s) = PreOpenStack stack "/data/user/0/com.trevix.it.segnapunto/files/Referi_/ReferiTOP.livecode"
2025,2,3,20,48,13,2 (Prev 0.002 s) = Loading Prefs
I believe that setting the passkey is the equivalent of reading a property of ReferiTOP, that is putting the stack in memory and, after that, removing it. That would explain why opening the stack still takes 13 seconds.