简体   繁体   中英

send/receive data via Bluetooth

I'm trying to send/receive a string from an android device. I've been googling for the last 3 hours and I can't find anything that just works. the closest I got was this: fella

and I get these errors:

 02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.err﹕ at com.example.jelle.bluetoothconnector.BluetoothConnection.init(BluetoothConnection.java:38) 02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.err﹕ at com.example.jelle.bluetoothconnector.BluetoothConnection.<init>(BluetoothConnection.java:25) 02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.err﹕ at com.example.jelle.bluetoothconnector.ConnectorActivity.btnBluetooth_onCLick(ConnectorActivity.java:92) 02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.err﹕ at java.lang.reflect.Method.invoke(Native Method) 02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:372) 

can anyone help me? I just need some code that can send/receive a string via bluetooth to get me started

Thanks!

The best and most comprehensive example is Android's official bluetooth chat example. You probably do not need to change most of the stuff. See this: https://github.com/googlesamples/android-BluetoothChat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM