Saving network file on Android

The engine.
Post Reply
Donhailim
Posts: 4
Joined: Wed Nov 27, 2013 2:25 pm

Saving network file on Android

Post by Donhailim »

Hello.

Does anyone know how to save a network file on an Android system? The 'writeFile("name.xdsl")' only gives me errors when running.
The usual manner of saving files in an application is to open an input and an output stream and use these to write to a file. But this requires there to be a file in the first place. Also the methods I've found so far will only read/write bytes from an array or variable, which don't seem to help a lot.

What I'm trying to do is first create a network of nodes and then store data from the smartphone sensors in these nodes. I need this data to be extracted in some way, and was really hoping to get this out in a format GeNIe can read.

Any help is appreciated.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Saving network file on Android

Post by shooltz[BayesFusion] »

What's the byte size and date for armeabi/libjsmile.so you're using?
Donhailim
Posts: 4
Joined: Wed Nov 27, 2013 2:25 pm

Re: Saving network file on Android

Post by Donhailim »

libjsmile.so size 1766 KB, downloaded 29th of October.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Saving network file on Android

Post by shooltz[BayesFusion] »

Donhailim wrote:libjsmile.so size 1766 KB, downloaded 29th of October.
I'll need a size in bytes and creation (not download) date. It would be also helpful if you provide some more information on errors you've got.
Donhailim
Posts: 4
Joined: Wed Nov 27, 2013 2:25 pm

Re: Saving network file on Android

Post by Donhailim »

Error:
W/System.err(9736): smile.SMILEException: SMILE error -103 in function WriteFile at smile.Network.writeFile(Native Method)

According to errors.h "-103" means DSL_WRONG_FILE.
This is the relevant error I'm getting now. I've not created applications that store files on Android before, so I might be missing something very basic, but I can't seem to figure out what.

File information:
Size: 1,807,964 bytes
Size on disk: 1,810,432 bytes
Created: 13 August 2013.

Any other information you might need or if I'm misunderstanding and giving the wrong stuff just let me know.

Thanks for helping.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Saving network file on Android

Post by shooltz[BayesFusion] »

Donhailim wrote:W/System.err(9736): smile.SMILEException: SMILE error -103 in function WriteFile at smile.Network.writeFile(Native Method)
Your issue is probably related to file permissions. Did you use getApplicationContext().getFilesDir() to build the complete path for the .xdsl file?

Code: Select all

File filesDir = getApplicationContext().getFilesDir();
String outFile = filesDir + "/outnet.xdsl";
net.writeFile(outFile);
Donhailim
Posts: 4
Joined: Wed Nov 27, 2013 2:25 pm

Re: Saving network file on Android

Post by Donhailim »

It was indeed permissions and correct file path that was missing.
Thanks a lot for the help, it works like a charm now!
Post Reply