Solved - Encrypted Android standalone - 9 seconds to open
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Solved - Encrypted Android standalone - 9 seconds to open
Hi
I hope to get my second LC app (a puzzle game) onto the Google Play Store next week. I'm in the final stages of testing. I've now encrypted my app, using the message box "set the password of this stack to ..." method, where-as during earlier development & testing it was un-encrypted.
On the 2nd launch (not the install launch) of my app on a mid-range Android test device :
> If my app is NOT ENCRYPTED - then I see 3.3 seconds of black screen between tapping the icon and my splash screen being displayed.
> If my app is ENCRYPTED - then I see 9 seconds of black screen between tapping the icon and my splash screen being displayed.
> Ive tested the milliseconds between the first line of my PreOpenStack and the last line of the OpenCard on my first card. For both encrypted and un-encrypted versions of my app it takes 300 milliseconds to go from the start of PreOpenStack to the splash screen being displayed. The other 3 to 8.7 seconds is whatever LC does before PreOpenStack.
1) Is there any way to encrypt an Android standalone & still have it open promptly?
2) How much (real) risk is there in not encrypting a LC (puzzle game) app which is going up on the Google Play Store?
Thanks in advance
Kim
I hope to get my second LC app (a puzzle game) onto the Google Play Store next week. I'm in the final stages of testing. I've now encrypted my app, using the message box "set the password of this stack to ..." method, where-as during earlier development & testing it was un-encrypted.
On the 2nd launch (not the install launch) of my app on a mid-range Android test device :
> If my app is NOT ENCRYPTED - then I see 3.3 seconds of black screen between tapping the icon and my splash screen being displayed.
> If my app is ENCRYPTED - then I see 9 seconds of black screen between tapping the icon and my splash screen being displayed.
> Ive tested the milliseconds between the first line of my PreOpenStack and the last line of the OpenCard on my first card. For both encrypted and un-encrypted versions of my app it takes 300 milliseconds to go from the start of PreOpenStack to the splash screen being displayed. The other 3 to 8.7 seconds is whatever LC does before PreOpenStack.
1) Is there any way to encrypt an Android standalone & still have it open promptly?
2) How much (real) risk is there in not encrypting a LC (puzzle game) app which is going up on the Google Play Store?
Thanks in advance
Kim
Last edited by KimD on Wed Apr 12, 2017 9:17 pm, edited 1 time in total.
Re: Encrypted Android standalone - 9 seconds to open
Do you have included some source stacks? For example 2 or more main stacks (different programs).
If you used just a main stack and substacks, you don't need to encrypt.
If in the stand alone application settings, "copy files" tab, there aren't livecode source files, you don't need to encrypt. The APK is a zip file, rename it with ".ZIP", open it and see what the user can see.
If you used just a main stack and substacks, you don't need to encrypt.
If in the stand alone application settings, "copy files" tab, there aren't livecode source files, you don't need to encrypt. The APK is a zip file, rename it with ".ZIP", open it and see what the user can see.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Encrypted Android standalone - 9 seconds to open
What is happening in your app's init sequence?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Encrypted Android standalone - 9 seconds to open
Thanks Max & Richard
My app currently only has a main stack (with 6 cards). Contents include:
- 3 images (about 50KB in total, with resize quality "normal") embedded in the app
- 5 MP3 files (about 500KB in total) in Standalone > Copy Files
- about 200 SVG widgets (I confess, I love SVG widgets)
- about 1500 lines of code, 50 buttons and 10 small text fields
The unencrypted APK file is 9500KB.
=====================================
On init my app does the below. According to my monitoring this executes in 300 milliseconds.
PreOpenStack
> Set the location of 3 files (saved state, puzzle results, in-app monitoring)
> mobileSetAllowedOrientations "portrait"
> Set the textfont of this stack to "Roboto"
InitialiseVariables1 > Set the values of 24 variables
ConfigureMainScreenGrid > Set the values of 125 variables
SetupCard
> Set the values of 2 variables
> Write 2 variables into the saved state file
> Choose which style of SVG widget (Android or IOS) to use for the back button
SetControlSizeLocation > Resize card. Determines the size & location of the controls on my first card, being:
- 2 images (both 21KB)
- 1 SVG widget
- 2 buttons
- 2 text fields
SetStrata > Set the layers of the above elements
OpenCard
> Write 6 variables into the saved state file
> mobileStoreEnablePurchaseUpdates & mobileStoreRestorePurchases
InitaliseVariables2 > Set the values of 23 variables
PositionScrollElements > Resize the 2 text fields & 1 image that make up the scrolling group on the first card
SetupScroller > Configure mobileControlSet
==============================================
Regards
Kim
LC 8.1.2 rc 3 Indy
My app currently only has a main stack (with 6 cards). Contents include:
- 3 images (about 50KB in total, with resize quality "normal") embedded in the app
- 5 MP3 files (about 500KB in total) in Standalone > Copy Files
- about 200 SVG widgets (I confess, I love SVG widgets)
- about 1500 lines of code, 50 buttons and 10 small text fields
The unencrypted APK file is 9500KB.
=====================================
On init my app does the below. According to my monitoring this executes in 300 milliseconds.
PreOpenStack
> Set the location of 3 files (saved state, puzzle results, in-app monitoring)
> mobileSetAllowedOrientations "portrait"
> Set the textfont of this stack to "Roboto"
InitialiseVariables1 > Set the values of 24 variables
ConfigureMainScreenGrid > Set the values of 125 variables
SetupCard
> Set the values of 2 variables
> Write 2 variables into the saved state file
> Choose which style of SVG widget (Android or IOS) to use for the back button
SetControlSizeLocation > Resize card. Determines the size & location of the controls on my first card, being:
- 2 images (both 21KB)
- 1 SVG widget
- 2 buttons
- 2 text fields
SetStrata > Set the layers of the above elements
OpenCard
> Write 6 variables into the saved state file
> mobileStoreEnablePurchaseUpdates & mobileStoreRestorePurchases
InitaliseVariables2 > Set the values of 23 variables
PositionScrollElements > Resize the 2 text fields & 1 image that make up the scrolling group on the first card
SetupScroller > Configure mobileControlSet
==============================================
Regards
Kim
LC 8.1.2 rc 3 Indy
Re: Encrypted Android standalone - 9 seconds to open
In case it is helpful, I also attach the results of the Message Watcher (in the IDE, not the Android app).
Regards
Kim
Regards
Kim
Re: Encrypted Android standalone - 9 seconds to open
The above images have been displayed in order 3, 2, 1. The 4th, and final, output of the message watcher is attached below.
Re: Encrypted Android standalone - 9 seconds to open
You don't need to encrypt. Malicious user could only copy the MP3 files.KimD wrote:Thanks Max & Richard
My app currently only has a main stack (with 6 cards).
...
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Encrypted Android standalone - 9 seconds to open
Have you been able to determine where the additional time is spent?KimD wrote:On init my app does the below. According to my monitoring this executes in 300 milliseconds.
Encryption can be expected to add a little extra time to unpack scripts, but with the relatively small number of scripts in play here that shouldn't be the cause of the extra delay. I would imagine unencrypting scripts should normally add only a few milliseconds to boot time.
You might consider filing a bug report on this to see what the core dev team suggests.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Encrypted Android standalone - 9 seconds to open
Maybe, just maybe, the Standalone builder is encrypting
all MP3 and Images too...
KimD, Could you verify this in your .apk installer?
Al
all MP3 and Images too...
KimD, Could you verify this in your .apk installer?
Al
Re: Encrypted Android standalone - 9 seconds to open
Damn - wrote a long reply then lost it when my forum connection timed out.
Short version.
I've identified that the problem is my 200 SVG widgets. If I reset the icon paths of these to the LC default icon path, then the load time for my encrypted Android standalone drops from over 8.5 seconds to under 2 seconds. It seems that LC is encrypting my complex icon path data, then spending 6.5+ seconds un-encrypting this when the app is launched.
Options that occur to me:
1) Store the icon path data in a copy file, and use this to populate the SVG widgets after the app launches.
2) Store the icon path data in an un-encrypted sub-stack.
3) Just not worry about encrypting my Android standalone.
Thanks in advance for any advice
Kim
Short version.
I've identified that the problem is my 200 SVG widgets. If I reset the icon paths of these to the LC default icon path, then the load time for my encrypted Android standalone drops from over 8.5 seconds to under 2 seconds. It seems that LC is encrypting my complex icon path data, then spending 6.5+ seconds un-encrypting this when the app is launched.
Options that occur to me:
1) Store the icon path data in a copy file, and use this to populate the SVG widgets after the app launches.
2) Store the icon path data in an un-encrypted sub-stack.
3) Just not worry about encrypting my Android standalone.
Thanks in advance for any advice
Kim
Solved - Encrypted Android standalone - 9 seconds to open
I realised that there was an easy solution available to me.
Only 10% of my SVG widgets are "source". The other 90% of my SVG widgets are derived, by copying a source SVG widget, during the execution of my app.
So I:
1) wrote a "SpringClean" handler which set the iconPath of my (approx 180) derived SVG widgets to empty; and
2) immediately before building my standalone, called SpringClean from the message box.
The encrypted version of my app now opens in under 2 seconds on my mid-range Android test device.
What I've learnt - clean up any derived graphics, including SVG widgets, before building a standalone.
Thanks for all of your help.
Kim
Only 10% of my SVG widgets are "source". The other 90% of my SVG widgets are derived, by copying a source SVG widget, during the execution of my app.
So I:
1) wrote a "SpringClean" handler which set the iconPath of my (approx 180) derived SVG widgets to empty; and
2) immediately before building my standalone, called SpringClean from the message box.
The encrypted version of my app now opens in under 2 seconds on my mid-range Android test device.
What I've learnt - clean up any derived graphics, including SVG widgets, before building a standalone.
Thanks for all of your help.
Kim
Re: Encrypted Android standalone - 9 seconds to open
Hi Kim,
instead of using the message box, add this handler in your stack script:
LC will send this message BEFORE it creates the standalone form your stack!
A quite helpful thing
There are more "standalone creating" related messages that may be helpful,
check the dictionary for "standalone".
Best
Klaus
instead of using the message box, add this handler in your stack script:
Code: Select all
on savingstandalone
springClean
end savingstandalone
A quite helpful thing
There are more "standalone creating" related messages that may be helpful,
check the dictionary for "standalone".
Best
Klaus
Re: Solved - Encrypted Android standalone - 9 seconds to op
Nice. Thanks Klaus
Kim
Kim