Cannot Connect to FTP on Gingerbread

I recently noticed that when I tried to run my application on Gingerbread emulation, this FTP broke. I am currently using the external apache commons library to support FTP, but for some reason it works on any other Android OS except 2.3 (Gingerbread)

Here is my FTP code

FTPClient ftp = new FTPClient(); ftp.connect(SERVER); ftp.login("anonymous", "anonymous"); ftp.setFileType(FTP.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); InputStream is = ftp.retrieveFileStream("file.txt"); byte[] data = new byte[1024]; fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); int x = 0; while((x=is.read(data,0,1024))>=0){ fos.write(data,0,x); } fos.flush(); fos.close(); ftp.logout(); ftp.disconnect(); 

As I said, this is tested and works on 1.6, 2.1 and 2.2, but not 2.3. I tried all day to find out why and how to fix it, but I can not find any solution.

So I wondered if anyone had any experience with FTP and Gingerbread, and if you would be so pleased to lead me in the right direction.

Thanks.

+6
android ftp
source share
2 answers

I do not know what causes the problem, but I found out that FTP on Android 2.3 works, but not in emulation.

At that moment, when I tried my code on my mobile phone, it worked the same way as in all previous versions of Android.

Thanks for the help!

+1
source share

The first thing I would like to check is if you have the correct permissions, if it is a Logcat case check for any exceptions. If you have, please post them here or through pastebin.

0
source share

All Articles