problem, how to start Android Bluetooth Socket connection?
i want to implement an app where i can send data(object/file) through bluetooth Socket programming,, but m not getting the way where to start,
i have created
private ArrayAdapter<String> mNewDevicesArrayAdapter;
for storing scanned devices, in BroadCastReceiver{ ...onReceive()... where i have this code..
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Get the BluetoothDevice object from the Intent
BluetoothDevice device =
intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
// Add the name and address to an array adapter to show in a ListView
mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
...}
and
String info = mNewDevicesArrayAdapter.getItem(0).toString();
// Get the device MAC address, which is the last 17 chars in the View
String address = info.substring(info.length() - 17);
System.out.println("In Auto "+mNewDevicesArrayAdapter.toString());
System.out.println("In Auto "+address);
this is successfully showing multiple scanned devices...
now i want to sen开发者_如何学编程d data to all devices store in array,, not getting the way???
how do i manage UUIDs for multiple devices ?
and where i can code AcceptThread, connectedThread, ConnectThread from http://developer.android.com/guide/topics/wireless/bluetooth.html, in separate class or in the same class where i am searching for devices, because in the chat example i can see that mNewDeviceArrayAdapter is in DeviceListActivity Class, while the Threads are in BluetoothChatService Class,
and what more i have to do,?
if i want to accept data from multiple devices, as if all devices have my app running, so they can send and receive data to one another.
I Hope, the question is understandable to the readers, and those who knows the solution will guide me soon,
Thanks in Advance Regards.
精彩评论