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 -- 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