Proper Example of Deploying Data Folder into Andriod App

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
pkmittal
Posts: 111
Joined: Thu Feb 08, 2007 11:27 am
Contact:

Proper Example of Deploying Data Folder into Andriod App

Post by pkmittal » Tue Jul 03, 2012 5:57 am

Hi, I have an app developed in Revolution for Windows. The App contains TEST Data Folder in the same location where the exe is located. The app reads and writes the data into TEST Data folder.

Now I would like to deploy that application on Andriod Device. I have few questions.

1. How Should I insert TEST Data folder into the application standlaone package?
a) Should we include in Standalone Aplication Settings-- Copy Files-Add folder ?
If yes then when we install the androd app then by default, TEST Data folder would be installed inside the engine folder. What I have underststood is that you can read from the engine folder but you can not write the data to it. So I think this is not the right place.
b) should those file exsit into the documents folders? If yes then what should I do so that when we install the app package then TEST DATA folder gets installed into documents folder.

2) Are there not any examples of proper apps which by default install the data folder, reads from it and writes to it..? Where can I find sample app for Andriod devices which has default data files at the time of instalation and then plays with it?

Please help.. thanks

Pradeep

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

Re: Proper Example of Deploying Data Folder into Andriod App

Post by jacque » Tue Jul 03, 2012 6:32 pm

You are correct you can't write to the engine folder. Build your app with the folder included in the Copy Files pane. When your Android app starts up, check to see if your folder (or any file in that folder) is already in Documents. The first time after installation the files will not be there, so a script should copy the folder to specialFolderPath("documents").

To do that, the script should first create a folder there and then copy each file into the new folder. On Android the "create folder" command will work. To copy files, use the syntax "put url x into url y":

Code: Select all

put specialFolderPath("documents") & "/TEST Data/" into tDestFolder
create folder tDestFolder
repeat for each item i in "file1,file2,file3"
  put url ("file:" & specialFolderPath("engine") & slash & i) into url ("file:" & tDestFolder & i)
end repeat
If you files aren't text files, use "binfile:" instead of "file:"
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply