I'm interested in doing just a simple FTP 'get' in my app. It works fine on the Palm Pre and WPF/C# and windows, but not the Android at least on the emulator and I can't find any examples from the searching I've done. I tried a simple:
but it gets an exception on getInputStream: Unable to connect to server: Unable to configure data port
And I know internet access works because I can do an http protocol request. I have the magical incantation in the manifest file to allow network access:
<uses-permission android:name="android.permission.INTERNET" />
Also, there must be a more intelligent way to pull the data out of the stream buffer than byte-by-byte, isn't there? I can't find that either.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32769
posted
0
I wouldn't rely on the URL ftp: scheme to work. The Apache Commons Net library has FTP client classes built in, and it works just fine on Android.
Too bad, the ftp URL scheme works fine on webOS and WPF/C#.
Could you please be a bit more specific about how to do what you suggest?
And how to make it work in the Eclipse/Emulator environment?
Would I need to refer a JAR library or something?
I tried the FTPClient library here: http://androiddev.orkitra.com/?p=139 but I can't get it to work either, says "NoClassDefFoundError" as though the library
is not available on the Emulator, but is available on Eclipse - the references get
resolved properly. It there some magical incantation I need in the AndroidManifest
file or something?
Thanks!
Paul Kinzelman
Greenhorn
Joined: Aug 15, 2011
Posts: 3
posted
0
Whew! I finally got it going.
After fixing the library access (Project | Properties | Java Build Path | Libraries | Add JARs...) I fiddled with the calls until it started working. Here's the sequence of my FTPClient calls. It wouldn't work until I set it in passive mode.