Hi, In android I used UUID from java.util and in j2SE I used UUID from javax.bluetooth. But in android when I remove the '-' and run the application it will show "The application has stopped unexceptedly" but I have solved the issue by using: static String uuid = "0000110100001000800000805f9b34fb"; static byte[] uuid1 = uuid.getBytes(); private static UUID MY_UUID = UUID.nameUUIDFromBytes(uuid1);
Now it doesn't crashes, but I am receiving nothing at the J2SE side. I not sure whether my J2SE application is correct. I am using StreamConnectionNotifier to receive the string. Is it correct? I used the code for J2SE server from the following website: http://www.jsr82.com/jsr-82-sample-spp-server-and-client/ Thanks In Advance, Perumal On Jul 28, 10:59 am, perumal316 <perumal...@gmail.com> wrote: > Just to add on. In my PC I am using Bluecove. Is it the correct one? > So far after searching for very long, I found no information about > Android(client)-PC(server) Bluetooth connection. > > So far all online references are for J2ME and J2SE (client-server) > Bluetooth connection. So can this be done? > > Regards, > Perumal > > On Jul 28, 9:46 am, perumal316 <perumal...@gmail.com> wrote: > > > Hi, > > > Is the UUID could be the problem? Because for Android the UUID have to > > have dashes. Like "00001101-0000-8000-...." but in J2SE the UUID could > > not have dashes like "0000110100008000....". Is this causing the > > problem? Or is there any other method? > > > Thanks In Advance, > > Perumal > > > On Jul 27, 8:22 pm, perumal316 <perumal...@gmail.com> wrote: > > > > Hi All, > > > > I am trying to establish a server (J2SE) and client (Android). The > > > client will send a string over to the server over Bluetooth. > > > > For Android the code snippet is as below: > > > > BluetoothAdapter adapter = null; > > > adapter = BluetoothAdapter.getDefaultAdapter(); > > > BluetoothDevice device = adapter.getRemoteDevice(address); > > > //I have hardcode the server bluetooth mac address > > > adpter.enable(); > > > > BluetoothSocket socket = null; > > > socket = device.createRfcommSocketToServiceRecord(MY_UUID); > > > socket.connect(); > > > sendMessage(socket, "Hello Bluetooth"); > > > //sendMessage is just a method I have created > > > > For the J2SE there is no BluetoothSocket (or is there?) I used > > > StreamConnection. The code snippet is as below: > > > > StreamConnectionNotifier con = (StreamConnectionNotifier) > > > Connector.open("btspp://localhost:"+UUID > > > +name=example;authorise=false"); > > > StreamConnection Strconn = con.acceptAndOpen(); > > > InputStream input = conn.openInputStream(); > > > System.out.println(input); > > > input.close(); > > > conn.close(); > > > > I am not sure whether an Android app can send a string over to a J2SE > > > application by Bluetooth. Could not find any reference online. Is it > > > possible? > > > > If possible is what I am doing above the correct method? Because I > > > receive nothing over at the server side (J2SE). I not sure is it > > > because I am using BluetoothSocket in android and StreamConnection for > > > J2SE. Is it? > > > > Thanks In Advance, > > > Perumal- Hide quoted text - > > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en