Android Programming Press on the image to return to the main documentation page.

FTP_Auto

Written by Margret

List of types:

FTP_Auto

FTP_Auto


This is an 'Activity Object', it cannot be declared under Sub Process_Globals.

Permissions:

android.permission.INTERNET
android.permission.ACCESS_WIFI_STATE
android.permission.ACCESS_NETWORK_STATE

Events:

None

Members:


  Close As String

  CloseNow As String

  DeleteFile (DeletePathAndFile As String) As String

  DeleteFileSet (VerifyBeforeDelete As Boolean) As String

  DownLoadFile (LocalPath As String, ServerPath As String, FileName As String, Delete_FromServer As Boolean) As String

  DownloadFileSet (LocalPath As String, Files_Path_And_Mask() As String, Delete_FromServer As Boolean) As String

  FileOrFolderExist (FTPFileExists As String, InThisDirectory As String, CheckForFolder As Boolean) As Boolean

  Initialize (Activity As ActivityWrapper, CalledFrom As Object, FTP_Site As String, UserName As String, PassWord As String, PortNumber As Int, ShowMessages As Boolean, UsePassiveMode As Boolean) As String

  IsInitialized As Boolean

  LastDownloadStats As String

  LastProcessSuccessful As Boolean

  LastUploadStats As String

  MakeDir (DirectoryName As String) As String

  RemoveDir (DirectoryName As String) As String

  SendCMD (MyCommand As String, MyParameters As String) As String

  SetColors (HeadingColor As Int, TotalProgressColor As Int, FileTextColor As Int, PanelBackgroundColor As Int, FrameColor As Int) As String

  SetCompletedDownloadDialog (ShowCompletedDialog As Boolean, DialogText As String) As String

  SetCompletedUploadDialog (ShowCompletedDialog As Boolean, DialogText As String) As String

  SetProcessCompleteOn (ProcessCompleteOn As Boolean) As String

  SetStealthOn (UseStealth As Boolean) As String

  SetStickyOn (MakeSticky As Boolean) As String

  SetText (HeaderDownLoadText As String, HeaderUploadText As String, TotalProgressText As String, FileProgressText As String, ButtonCancelText As String, ButtonDoneText As String) As String

  SetTextSize (HeaderTextSize As Int, TotalProgressTextSize As Int, FileProgressTextSize As Int, CancelAndDoneTextSize As Int) As String

  UpLoadFile (LocalPath As String, ServerPath As String, FileToSend As String) As String

  UploadFileSet (ServerPath As String, Files_Path_And_Mask() As String, DeleteFileFromLocalDevice As Boolean) As String

  WiFi_IsConnected As Boolean

Members description:

Close As String
Completes the current Que with any files left to process and then
closes the connection.
CloseNow As String
Closes the connection and all other files in the Que are
ignored and the process is terminated.
DeleteFile (DeletePathAndFile As String) As String
Deletes a single file from the server.
Example:

DeleteFile("public/pictures/airplane1.jpg")
DeleteFileSet (VerifyBeforeDelete As Boolean) As String
Delete the lastest FileSet in memory from the server.
If you used a Mask to download a set of files, this function
will delelete all files in that last set.
NOTICE: use with care.
DownLoadFile (LocalPath As String, ServerPath As String, FileName As String, Delete_FromServer As Boolean) As String
Downloads a selected file from the FTP server and optionally deletes the file after successful download
Example:

DownLoadFile("/mnt/sdcard/pictures/", "public/downloads/", "airplane.jpg", False)
DownloadFileSet (LocalPath As String, Files_Path_And_Mask() As String, Delete_FromServer As Boolean) As String
Retrieves a list of files from the server matching the Mask(s) passed to Files_Path_And_Mask() array.
You should include the full server path in the Mask. It will then download these files to
the Folder passed in LocalPath. Files_Path_And_Mask() can contain one entry or however many is needed.
Example:

DownloadFileSet(File.DirInternal, Array As String("SM*.txt", "public/pictures/pla*.jpg"), False)
FileOrFolderExist (FTPFileExists As String, InThisDirectory As String, CheckForFolder As Boolean) As Boolean
Allows you to check if a File Exist in the Root or a specified directory. Pass
the name of the File you are looking for in FTPFileExists. Pass "/" to search in the Root
directory or pass the path and directory name to: InThisDirectorysearch. If True is passed
for the last parameter, folders will be returned instead of files.

Example: FileOrFolderExist("myairplane.jpg", "files/images/aircraft", False)
NOTE: A sub like below is required for a callback with the information about if the file was
found. Place this sub in the calling module. This is required because of the Libs modeless operation.

Sub FTP_FileExist(Found As Boolean)
If Found Then Log("True") Else Log("False")
End Sub
Initialize (Activity As ActivityWrapper, CalledFrom As Object, FTP_Site As String, UserName As String, PassWord As String, PortNumber As Int, ShowMessages As Boolean, UsePassiveMode As Boolean) As String
Initializes the object for use. If True is passed for ShowMessages, additional
messages will be displayed throughout the process. Use the keywords "Activity"
and "Me" For the first two parameters.
Example:

Initialize(Activity, Me, "ftp.yourdomain.com", "userName", "PassWord", "Port", True, False)
IsInitialized As Boolean
Tests whether the object has been initialized.
LastDownloadStats As String
Shows a popup window with the detials of the latest Download(s).
LastProcessSuccessful As Boolean
Returns True if the last Upload or Download process was successful, otherwise returns False.
LastUploadStats As String
Show a popup window with details of the latest Upload(s).
MakeDir (DirectoryName As String) As String
Makes a directory on the FTP server. Does nothing if the directory already exist.
If you want to make a directory in the root of the server and then a directory under
it, you must issue the command twice.
Example:

MakeDir("test")
MakeDir("test/datafolder")
RemoveDir (DirectoryName As String) As String
Removes selected directory from the FTP server
SendCMD (MyCommand As String, MyParameters As String) As String
Allows you to send FTP commands with parameters to the server
SetColors (HeadingColor As Int, TotalProgressColor As Int, FileTextColor As Int, PanelBackgroundColor As Int, FrameColor As Int) As String
Used to set colors of each Item in the status dialog.
NOTE: Passing 0 for any argument with leave that item unchanged
SetCompletedDownloadDialog (ShowCompletedDialog As Boolean, DialogText As String) As String
If ShowCompletedDialog=True, it will show a dialog after the download process is completed.
SetCompletedUploadDialog (ShowCompletedDialog As Boolean, DialogText As String) As String
If ShowCompletedDialog=True, it will show a dialog after the upload process is completed.
SetProcessCompleteOn (ProcessCompleteOn As Boolean) As String
Use this function to determine by code when the Upload or Download is finished.
The calling Activity must contain a sub named FTP_ProcessComplete. If your calling
Activity includes this sub and you set this function to True, then the sub will
be called as soon as the process has completed. EXAMPLE:

'Add this sub to calling Activity
Sub FTP_ProcessComplete
'Your code here...
End Sub
SetStealthOn (UseStealth As Boolean) As String
If set to True, no progress box will be displayed during the file
transfer. If False the progress dialog will show during the file
transfers. The default is False.
SetStickyOn (MakeSticky As Boolean) As String
If set to True, the progress box will stay on the screen until
the user taps the Done button, otherwise the progress box will close
as soon as the transfer is complete. The default is False.
SetText (HeaderDownLoadText As String, HeaderUploadText As String, TotalProgressText As String, FileProgressText As String, ButtonCancelText As String, ButtonDoneText As String) As String
Used to set the Text of the Item's status display.
NOTE: May be used for different language, etc.
SetTextSize (HeaderTextSize As Int, TotalProgressTextSize As Int, FileProgressTextSize As Int, CancelAndDoneTextSize As Int) As String
Used to set the Text size of the Item's Text in the status dialog.
NOTE: Passing 0 for any argument with leave that item unchanged
UpLoadFile (LocalPath As String, ServerPath As String, FileToSend As String) As String
Uploads a single file passed in FileToSend

Example: UpLoadFile("/mnt/sdcard/pictures", "uploads/pictures", "vacation.jpg")
UploadFileSet (ServerPath As String, Files_Path_And_Mask() As String, DeleteFileFromLocalDevice As Boolean) As String
Retrieves a list of files from the local device. The Files_Path_And_Mask() array should contain the full
path to the local devices files. It will then upload these files to the server.
Files_Path_And_Mask() array can contain one entry or however many is needed.
Example:

UploadFileSet("uploads/pictures/", Array As String("/mnt/pictures/VA*.jpg", "/mnt/sdcard/backups/contact*.dat"), False)
WiFi_IsConnected As Boolean
Check if Wifi is connected
Returns True if connected otherwise returns False
Top