Spanish ftp_listcompleted sin files

xamminf

Member
Hola a todos.

Muchísimo tiempo sin aparecer por aquí.

Una pregunta, si es posible.
Una App con mucho tiempo, recompilada con b4a 9.80 al recibir ficheros por Ftp, en el evento Ftp_Listcompleted viene success= True, pero Files vacio, cuando realmente SI hay ficheros en el Ftp.

Si me funciona en unos terminales, pero en el que tengo Android 10 no me funciona.

Algún tip ?


B4X:
Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
    Dim cFile As String:       cFile       = cFileDown
    Dim cFolderFile As String: cFolderFile = cFolderFileDown
   'Msgbox("completado " & CRLF & ",  resultado: " & Success, ServerPath )
   
    'lListCompleted = True
    If Success == False Then
        Log(LastException.Message)
    Else
        'Msgbox("viendo tema", Files.Length)
       'aFilesRecibe = Files
        'For i = 0 To Files.Length - 1
        '    'Log(Files(i).Name)
        'Next
        'For i = 0 To Folders.Length - 1
        '    Log(Folders(i).Name)
        'Next
       
        If lFileInFtp(Files, cFile) Then
           ' Parametrizar bien la carpeta destino y el nombre fichero destino... deberia meterlo todo en un objeto...
           FTP.DownloadFile(cFolderFile, False, Rut.oApl.cRutaDb, "maestros.db")
        Else
            'Msgbox("Fichero no encontrado !!", cFile)
            Msgbox("Fichero no encontrado !!", cFile & CRLF & cFolderFile & CRLF & Rut.oApl.cRutaDb)
            FinFtp1
            FinFtp2
        End If
    End If
End Sub


Sub lFileInFtp(aFilesRecibe() As FTPEntry, cFile As String)
Dim nI As Int
Dim lFile As Boolean: lFile = False

For nI = 0 To aFilesRecibe.Length- 1
   'Msgbox(cFile & "///" , aFilesRecibe(nI).Name & "///\\\" &  aFilesRecibe(nI).Name = cFile)
   If aFilesRecibe(nI).Name = cFile Then
       lFile = True
        Exit
    End If
Next
Return lFile
End Sub

'Sub btn_download_Click
'    FTP.PassiveMode = True
'    FTP.Initialize("FTP", "your FTP location", 21, "user", "passw")
'    FTP.List("public_html/your folder or file")
'      
'End Sub

Saludos
 

josejad

Expert
Licensed User
Longtime User
Por disparar al aire, de lo poco que he leído por el foro por ahora relacionado con Android 10, ¿estás ejecutando esto en un servicio?
Vi en el tutorial de Background location tracking

There is a new requirement in Android 10+ devices.
In order for the location tracking to continue working in the background, if the user chooses the "allow while app is open" permission option we need to add this line to the manifest editor:
B4X:

SetServiceAttribute(Tracker, android:foregroundServiceType, "location")
It also requires installing "android sdk platform 29" with B4A Sdk Manager and configuring the path to android.jar under Tools - Configure Paths to android.jar from platform 29.

Y en el tutorial de android.jar / targetSdkVersion / minSdkVersion se indica para Android 10:
- 29 - No permission to access File.DirRootExternal, even with the STORAGE permission. For now there is a simple workaround:
B4X:
B4X:
SetApplicationAttribute(android:requestLegacyExternalStorage, true)

No veo relación en principio con tu código, pero no sé si estarás haciendo algo en otra parte con el sistema de archivos que pudiese afectar.

saludos,
 

xamminf

Member
Hola José. J,

Gracias por responder.
Me pareciera que lo que comentas está más relacionado con la ubicación que con el Ftp.

Mi manifest es este:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Light")
 

josejad

Expert
Licensed User
Longtime User
No veo nada raro, ahí, en todo caso el target.
Si quieres, prueba a "resetearlo", borra todo el manifest (cópialo en algún sitio por si acaso), ciérralo, y vuelve a abrirlo. Verás que se actualiza con la configuración por defecto.

Al no usar tú ese target, no creo que tenga relación, pero en el post que te puse antes indica:
- 28 - Non-ssl (non-https) communication is not permitted by default. It can be enabled in B4A v9+ by adding this line to the manifest editor:
Code:
CreateResourceFromFile(Macro, Core.NetworkClearText)

Podrías probar a agregar esa última línea en el manifest a ver si tiene alguna relación con Android 10, aunque creo que en ese caso recibirías un aviso en el log.
¿Puedes pegar un log de algún teléfono en el que te esté funcionando, y el log de uno con Android 10 a ver si vemos alguna diferencia?

Por cierto, que quizás debieras actualizar tu ejemplo para usar wait for.
 

xamminf

Member
Solucionado incluyendo el comando ftp.passive=true
Lo tenía puesto para la subida pero no para la bajada. Lo extraño, o a mi me lo parece, es que en otros terminales si estaba funcionado sin ponerlo. :rolleyes:
 
Top