Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not connect an iOS to an Android device #2

Open
dittmarconsulting opened this issue Oct 3, 2018 · 1 comment
Open

Can not connect an iOS to an Android device #2

dittmarconsulting opened this issue Oct 3, 2018 · 1 comment

Comments

@dittmarconsulting
Copy link

dittmarconsulting commented Oct 3, 2018

Love both libraries (Rusel's and yours)

Everything works find on Android but I have issues connecting to an Android device. To be safe I have paired both devices manually beforehand.

I have the UUID (i.e. '00001103-0000-1000-8000-00805f9b34fb') but I'm not able to connect to the Android device running your lib on an iOS device (iPhone 8, iOS12, Xcode10)

In essence I'm running the following function

import BluetoothSerial from 'react-native-bluetooth-serial'

const connect = async (btId) => {
    return await BluetoothSerial.connect('00001103-0000-1000-8000-00805f9b34fb')
}

Any idea what the problem might be? I've had a look at the Objective-C code but everything looks fine to me.

Here the log:

2018-10-03 12:34:47.267357+1000 btTestApp[728:288833] connect
2018-10-03 12:34:47.267395+1000 btTestApp[728:288833] Scanning for BLE Peripherals
2018-10-03 12:34:47.267760+1000 btTestApp[728:288833] scanForPeripheralsWithServices
2018-10-03 12:34:50.268846+1000 btTestApp[728:288833] Stopped Scanning
2018-10-03 12:34:50.268951+1000 btTestApp[728:288833] Known peripherals : 0
2018-10-03 12:34:50.269035+1000 btTestApp[728:288833] List of currently known peripherals :
2018-10-03 12:34:50.269150+1000 btTestApp[728:288833] Could not find peripheral (null).
2018-10-03 12:34:50.343835+1000 btTestApp[728:288833] disconnect

By the way, both devices use classic BT NOT BLE

Many thanks in advance.
Tom

@jhonber
Copy link
Owner

jhonber commented Oct 4, 2018

Have you tried using BluetoothSerialExample? There is a function to connect to device:

connect (device) {
    BluetoothSerial.connect(device.id)
    .then((res) => {
      Toast.showShortBottom(`Connected to device ${device.name}`)
    })
    .catch((err) => Toast.showShortBottom(err.message))
}

Using this code you can check with .catch() if there is a problem with connection.

On the other hand, in the original repository there is not an issue related with yours, so that I expect it works, nevertheless I cannot assure you that this library works as expected on IOS, because I'm not test it yet on IOS. I'm going to test it on IOS soon, so please let me know if you have any progress.

Thanks.
Jhonber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants