Android Question FTP - List Completed

rbw152

Member
Licensed User
Longtime User
Hi,

I'm having trouble getting the FTP.List to call the FTP_ListCompleted Event. Looking around the forum, I learned that the FTP.List function should call the FTP_ListCompleted event when there's data retrieved. My program uses the FTP.List function but the event is never called.

I've tested the FTP credentials using filezilla (IP, username, password and port) and all seems well.

I must be using FTP in the wrong order perhaps, but it's got to the point where i'm just confused.

Help? :p

The code below is from a code module called from another activity. The reason for FTP is to allow for an update of the program APK. The global variables are used later in the ListCompleted event, but since this is never called, I deemed it unnecessary to post (keep things as simple as possible).

B4X:
Sub Process_Globals
   Dim FTP As FTP
   Dim Fname As String
   Dim FVersion As String
   Dim ServerIP As String
   Dim URL As String
End Sub

Public Sub CheckForUpdates(URL1 As String,ServerIP1 As String,Fname1 As String,FVersion1 As String)
    URL = URL1
    ServerIP = ServerIP1
    Fname = Fname1
    FVersion = FVersion1

    FTP.Initialize("FTP",ServerIP,21,"*****","*****")
    FTP.List("/") 'ListCompleted Sub Called Automatically
End Sub

Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
    If Success = False Then
        Log(LastException)
    Else
        Log("FTP Success")
    End If
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Maybe you want to have a look at this example... It´s using the ftp.List command..
 
Upvote 0

rbw152

Member
Licensed User
Longtime User
Thanks very much. Got the example running and it immediately highlighted my problem: My List_Completed event was also inside the code module, when it should have been in the activity. I moved my List_Completed event into the activity module and everything comes to life!

Thanks again ;)
 
Upvote 0
Top