Android Question Transfer image file over serial port

mre58

Member
Licensed User
Longtime User
I was able to transfer image files over wifi from my vb.net program to my android device and it works great. What I want to do now is do the samething, but using bluetooth because I may not be able to connect my devices over wifi. I figured the easiest option would be to transfer over a serial port. I tried modifying the code to work over a serial port and no go. I basically tried to take what I did with wifi and asyncstreamsprefix, but is not working. I did some searching on the web and found some code I was able to make work. I had to use asyncsteam without the prefix though. When I send the file over from my vb.net program I can see the binary symbols of the file in the text box of the b4a app. So I am sending over I just don't know how to take what I am sending and save it to a file. I am using the example b4a bluetooth app on the android device. Looking for some help.
B4X:
        fileToSend = "c:\test\test1.png"
        Dim oFile As System.IO.FileInfo = New System.IO.FileInfo(fileToSend)
        Dim numBytes As Long = oFile.Length
        Dim fStream As New FileStream(fileToSend, FileMode.Open, FileAccess.Read)
        Dim br As New BinaryReader(fStream)
        Dim data As Byte() = br.ReadBytes(CInt(numBytes))
        br.Close()
        fStream.Close()

        SerialPort1.Write(data, 0, numBytes)

Thank you
 

mre58

Member
Licensed User
Longtime User
I had thought about that, but not sure about how to set it all up. The example is over the network. I have that all working, just not sure how to do this over serial. The images I will be sending are small.

 
Upvote 0

mre58

Member
Licensed User
Longtime User
There are two links. The first one is done over Bluetooth.

I saw the 2 links, but the first sends text over bluetooth and the second looks at sending files over wifi. I can't find any examples that look at sending files over bluetooth.
 
Upvote 0
Top