This is custom hooks packages of https://github.com/innoveit/react-native-ble-manager project.
This library uses react-native-ble-manager to use bluetooth functions. Therefore this library needs to be installed AND linked into your project to work.
RN 0.60+
- iOS 8+
- Android (API 19+)
npm i --save react-native-ble-manager-hooks
const { loading, onWriteCommand } = useWrite()
const getMacAddress = async () => {
const data = [\x00, \x00, \x00]
const [res, err] = await onWriteCommand({
peripheralID:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
serviceUUID: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
characteristicUUID: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
data
})
if(err) {
//error logic
}
}