File Generation & Handling in Smart Devices (Genexus)

1.5k views Asked by At

I'm working on a Mobile Application in Genexus X Evolution 3 (iOS) which executes an External Object method (objective-c) made by me that gathers motion info. All this info generates a CSV file, which I want to grab with Genexus and send to an online server. My problem is I can't find the directory where the file is stored. I know Genexus creates a 'GXData' directory inside the 'Documents' directory to avoid the use of the same directory in which the offline databases are created, but I don't know how to access this directory from a procedure in Genexus, So please if anyone can lend me a hand on this I will be in your debt forever!

Best Regards!

2

There are 2 answers

0
Marcos Crispino On BEST ANSWER

There is no way in iOS to know the application's installation directory during the development process.

That's why the Directory data type defines three static properties, to be used by the GeneXus developer. This properties are platform-independent, installation-independent, so you can use them safely.

The defined properties are:

  • ApplicationDataPath: points to Documents/GXData/
  • ExternalFilesPath: same as ApplicationDataPath on iOS, the external memory path for Android
  • TemporaryFilesPath: the tmp/ folder for the application.

You could write for example

&file.Source = Directory.TemporaryFilesPath + &file.Separator + "myFile.txt"

where &file is defined to be of type File.

And then, you can read the content of the file with:

&fileContent = &file.ReadAllText()

Be warned that if the file is too big, it may cause memory or performance issues.

0
Leonardo Piñeyro On

You have to use the static properties of the Directory data type in order to access the local directories of the device. Using these properties you can easily work with the file system of the device like any other GeneXus application.

If you want to learn more about these properties and many other considerations please refer to: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?27388