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.
Saving network file on Android
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Saving network file on Android
What's the byte size and date for armeabi/libjsmile.so you're using?
Re: Saving network file on Android
libjsmile.so size 1766 KB, downloaded 29th of October.
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Saving network file on Android
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 wrote:libjsmile.so size 1766 KB, downloaded 29th of October.
Re: Saving network file on Android
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.
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.
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Saving network file on Android
Your issue is probably related to file permissions. Did you use getApplicationContext().getFilesDir() to build the complete path for the .xdsl file?Donhailim wrote:W/System.err(9736): smile.SMILEException: SMILE error -103 in function WriteFile at smile.Network.writeFile(Native Method)
Code: Select all
File filesDir = getApplicationContext().getFilesDir();
String outFile = filesDir + "/outnet.xdsl";
net.writeFile(outFile);
Re: Saving network file on Android
It was indeed permissions and correct file path that was missing.
Thanks a lot for the help, it works like a charm now!
Thanks a lot for the help, it works like a charm now!