react-native-ble-manager icon indicating copy to clipboard operation
react-native-ble-manager copied to clipboard

Data not received by Android of lower version(5.1.0)

Open qingjiaowochengzd opened this issue 4 years ago • 3 comments

Version

Tell us which versions you are using:

  • react-native-ble-manager v6.6.8
  • react-native v0.55.4
  • iOS/Android v.5.1.0 4.4.4

Expected behaviour

IOS and android v8.0.0 can receive no problem.

android v5.1.0 after startNotification can not listen data

bleManagerEmitter.addListener( 'BleManagerDidUpdateValueForCharacteristic', ({ value, peripheral, characNotif, service }) => { console.log("received a notif", value) } );

Actual behaviour

IOS and android v8.0.0 can get data

Steps to reproduce

connectBle = async (peripheral) => { try { await BleManager.connect(peripheral.id) console.log('连接成功', peripheral)

  const peripheralInfo = await BleManager.retrieveServices(peripheral.id)
  console.log(peripheralInfo)

  let serviceUuid = '49535343-fe7d-4ae5-8fa9-9fafd205e455'
  let characteristicUuid = "49535343-1e4d-4bd9-ba61-23c647249616"

  const Notification = await BleManager.startNotification(peripheral.id, serviceUuid, characteristicUuid)

  bleManagerEmitter.addListener(
    'BleManagerDidUpdateValueForCharacteristic',
    ({ value, peripheral, characNotif, service }) => {
        console.log("received a notif", value)
    }
  );

} catch (err) {
  console.log(err)
  Toast.fail(err, 2, null, false)
}

}

Stack trace and console log

qingjiaowochengzd avatar May 13 '20 11:05 qingjiaowochengzd

Hi, we tested on android 4.4.2 so probably is your device that have son problem.

marcosinigaglia avatar May 14 '20 14:05 marcosinigaglia

Version

Tell us which versions you are using:

  • react-native-ble-manager v6.6.8
  • react-native v0.55.4
  • iOS/Android v.5.1.0 4.4.4

Expected behaviour

IOS and android v8.0.0 can receive no problem.

android v5.1.0 after startNotification can not listen data

bleManagerEmitter.addListener( 'BleManagerDidUpdateValueForCharacteristic', ({ value, peripheral, characNotif, service }) => { console.log("received a notif", value) } );

Actual behaviour

IOS and android v8.0.0 can get data

Steps to reproduce

connectBle = async (peripheral) => { try { await BleManager.connect(peripheral.id) console.log('连接成功', peripheral)

  const peripheralInfo = await BleManager.retrieveServices(peripheral.id)
  console.log(peripheralInfo)

  let serviceUuid = '49535343-fe7d-4ae5-8fa9-9fafd205e455'
  let characteristicUuid = "49535343-1e4d-4bd9-ba61-23c647249616"

  const Notification = await BleManager.startNotification(peripheral.id, serviceUuid, characteristicUuid)

  bleManagerEmitter.addListener(
    'BleManagerDidUpdateValueForCharacteristic',
    ({ value, peripheral, characNotif, service }) => {
        console.log("received a notif", value)
    }
  );

} catch (err) {
  console.log(err)
  Toast.fail(err, 2, null, false)
}

}

Stack trace and console log

I met the same problem

llMrRongll avatar Jul 28 '20 09:07 llMrRongll

same problem In Android 10 works well In Android 5.1 calling Blemanager.connect() no return. no success no fail.

reworldgit avatar Oct 09 '20 07:10 reworldgit