Hide files from APK Assets

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Jason1234
Posts: 42
Joined: Sat Jun 18, 2011 9:20 am

Hide files from APK Assets

Post by Jason1234 » Sun Jan 08, 2012 12:20 pm

When you build your Android application, you get a .APK file extension for distribution. This is a compressed file containing the files required by your completed application. The files can therefore easily be viewed and copied out by most archive extraction tools.

I know that SQLite cannot be encrypted for mobile use (yet) but I would like to know if it was possible to hide the Database file inside the application files as a custom property...or something? I believe you can use custom properties for this but I am checking I understand it correctly.

If I create a custom property named "DB" of a seperate sub stack and set the file link so that it appears in the custom property inspector is this then added to the application at build time allowing me to refer to it later i.e URL binfile etc and so on?

Basically is this actual file embedded in the sub stack custom property.... Searching through countless posts has failed to actually explain what happens to the file for the custom property.... or actually how to do it. I need to extract it and place it in a directory when the application is run... this at least hides it from the APK file... I hope.

Please can someone point me in the right direction....
Windows / MAC / IOS / Android - Deployment
Build 5.5.4 / & Community Version 6.1

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Hide files from APK Assets

Post by sturgis » Sun Jan 08, 2012 4:52 pm

Just a quick example of storing a file the property of a stack.

Code: Select all

answer file "what file to save in stack?"
   if the result is empty then
      put "binfile:" & it into tFile
      set the storedfile of stack "stackname" to url tFile
   end if
this sets the contents of the storedfile to the contents of whatever file was selected.

To get the file back out reverse the process.

put the storedfile of stack "stackname" into URL "binfile:/path/to/whateveryouwanttocallit"

Just make sure you have the most updated sql file stored in the property before build.

Jason1234
Posts: 42
Joined: Sat Jun 18, 2011 9:20 am

Re: Hide files from APK Assets

Post by Jason1234 » Mon Jan 09, 2012 2:24 am

Perfect!

Thank you for taking the time to respond... just what I needed.

Regards

Jason
Windows / MAC / IOS / Android - Deployment
Build 5.5.4 / & Community Version 6.1

Post Reply

Return to “Android Deployment”