I upload many files on FTP and do it that way:
If uploading is long (the internet is slow or there are many files), then the phone goes to sleep mode and the uploading stops. How can I make it not to stop after going to sleeping mode or blocking? Or to make the phone not to block itself till the uploading is finished?
B4X:
Sub UpLoad
ToastMessageShow("Upload, wait...",False)
UpLo=File.ListFiles(File.DirInternal&"/test")
kolupload=UpLo.Size-1
If UpLo.Size<>0 Then
FTP.UploadFile(File.DirInternal&"/test",UpLo.Get(kolupload),False,"/test/"&UpLo.Get(kolupload))
Else
ToastMessageShow("Nothing upload...",True)
End If
End Sub
Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then
Log(LastException.Message)
ToastMessageShow(LastException.Message,False)
Else
If kolupload=0 Then
ToastMessageShow("All files uploaded",False)
Else
kolupload=kolupload-1
FTP.UploadFile(File.DirInternal&"/test",UpLo.Get(kolupload),False,"/test/"&UpLo.Get(kolupload))
End If
End If
End Sub