Closed KartikDevarde2601 closed 8 months ago
sorry my bad i connetting wrong way
async function conectar() { try { const device = await RNBluetoothClassic.connectToDevice(DEVICE_ID); console.log('Conexión exitosa!'); setConnectedDevice(device.id); console.log('connectedDevice: ', connectedDevice); console.log('address: ', device.id); await RNBluetoothClassic.writeToDevice(DEVICE_ID, '1'); } catch (error) { console.error('Error al conectar:', error); // Handle error accordingly } }
this correct code
Mobile Device Environment Provide a list of operating systems on which this issue is relevant.
Application Environment Provide information about your development environment:
Describe the bug on press i call the pairdevice function with string address but i not getting anything ...
`import React from 'react'; import {View, Text, StyleSheet, TouchableOpacity} from 'react-native'; import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'; import {faMicrochip} from '@fortawesome/free-solid-svg-icons/faMicrochip'; import {faHeadset} from '@fortawesome/free-solid-svg-icons/faHeadset'; import {useState} from 'react';
import RNBluetoothClassic, { BluetoothDevice, } from 'react-native-bluetooth-classic';
const RenderItem = ({item}) => { const connectToDevice = async address => { try { console.log('Connecting to device', address); let stringAddress = address.toString();
};
return ( <TouchableOpacity onPress={() => connectToDevice(item.address)}>
); };
export default RenderItem; ` LOGS
LOG Running "BluetoothClassic" with {"rootTag":31} LOG true LOG phone Bluetooth is ON/OFF: true LOG Connecting to device 98:D3:71:F6:C2:68 LOG Connecting to device 98:D3:71:F6:C2:68 LOG Connecting to device 98:D3:71:F6:C2:68