B4R Question serial communication with android

newbie

Member
Licensed User
Longtime User
Hi,
has somebody a Sample-code (B4A and B4R) how to communicate with a android device
over the android-usb port

Thanks vor hints
 

newbie

Member
Licensed User
Longtime User

Hi Erel,

i am using a usb to serial adapter (based on FTDI) like this
http://www.ebay.de/itm/FTDI-FT232RL...o-NePN-/302194919338?var=&hash=item465c3887aa

but i get every time
manager.GetDevices.length = 0

have you any suggestions ?

B4X:
    manager.Initialize
     If manager.GetDevices.Length = 0 Then
       Log("No connected usb devices.")
       ToastMessageShow("No USB", True)
     Else
       Dim device As UsbDevice = manager.GetDevices(0) 'assuming that there is exactly one device
       If manager.HasPermission(device) = False Then
         ToastMessageShow("Please allow connection and click again.", True)
         manager.RequestPermission(device)
       Else
         usbserial.Initialize("serial", device, -1)
         usbserial.BaudRate = 115200
         usbserial.DataBits = usbserial.DATA_BITS_8
         usbserial.StartReading
         Log("USB-Serial installiert")
         ToastMessageShow("USB installiert.", True)
       End If
     End If
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

newbie

Member
Licensed User
Longtime User


I have try both links at a older doogge Android (4.2.2) and a new xgody(Android 5.1):
- the file android.hardware.usb.host.xml is ok on all devices
- the chainfire usbdiagnostics(1.3) cannot installed (parsing error) on all devices
- another tool "UsbHostChek" runs and say the android.hardware.usb.host.xml is ok
but a handheld_core_hardware.xml and tablet_core_hardware.xml are not ok
try to fix it gives a error

???
What can i do ??????
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…