Android Question send a file from Android device to Windows PC

mario53

Member
Licensed User
with an app in B4A I managed to connect a Windows PC via WiFi with Android device.
There is a library that allows you to see the windows PC resources and therefore be able to send a file to a folder.
 

mario53

Member
Licensed User
I tried this example, downloaded app in wifi and executed.

This compilation
LogCat connected to: B4A-Bridge: samsung GT-I9301I
--------- beginning of /dev/log/main
** Activity (main) Pause, UserClosed = true **
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Installing file.
PackageAdded: package:b4a.example
Copying updated assets files (1)
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
(SmbException) jcifs.smb.SmbException: The network name cannot be found.
** Activity (main) Pause, UserClosed = false **
** Service (starter) Destroy **
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)

debugging gives me this error:
(SmbException) jcifs.smb.SmbException: The network name cannot be found.
----------------------------------------------------------------------------------------
this is the code:

#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
Dim SMB1 As SMB
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
SMB1.Initialize("SMB1")
End If
SMB1.ListFiles("smb://USER-PC/Users/Public/", "")
End Sub

Sub SMB1_ListCompleted(Url As String, Success As Boolean, Entries() As SMBFile)
If Not(Success) Then
Log(LastException)
Else
For i = 0 To Entries.Length - 1
Log("*****************")
Log(Entries(i).Name)
Log(Entries(i).Directory)
Log(DateTime.Date(Entries(i).LastModified))
Log(Entries(i).Parent)
Log(Entries(i).Size)
Next
End If
End Sub

where the error?
 
Upvote 0

mario53

Member
Licensed User
I temporarily solved the problem by giving all permissions to smb library.
so now I see the network and all of SMB1.ListFiles file path ( "smb: // USER-PC / Users / Public /", "")
the problem is if I change path SMB1.ListFiles ( "smb: // USER-PC / temp / test /", "") returns the error
(SmbException) jcifs.smb.SmbException: The network name cannot be found.

thank
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…