I am developing a bluetooth application for my MSc. Complete the project. It includes a server implemented in JAVA ME and a client written in Android.
The problem is that Android SDP does not seem to be able to recognize the ServiceRecord of my JAVA ME server.
If I use the techniques BluetoothDevice.getUuids()and BluetoothDevice.fetchUuidsWithSdp()to my client, they return set UUID, but my service UUID nowhere among them, so I can not connect to it.
This is the code for an example JAVAME server:
public class StackOverFlowServer extends MIDlet {
Display mDisplay;
Form mForm;
LocalDevice local;
StreamConnectionNotifier server;
ServiceRecord sr;
String conURL;
StreamConnection conn;
public StackOverFlowServer() {
mDisplay = Display.getDisplay(this);
mDisplay.setCurrent(mForm);
mForm = new Form(null);
conURL = "btspp://localhost:68EE141812D211D78EED00B0D03D76EC;"
+ "authenticate=false;encrypt=false;name=MySampleApp";
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}
protected void pauseApp() {
}
protected void startApp() throws MIDletStateChangeException {
try {
local = LocalDevice.getLocalDevice();
} catch (BluetoothStateException e) {
}
try {
server = (StreamConnectionNotifier)
Connector.open(conURL);
} catch (IOException e1) {
}
try {
sr = local.getRecord(server);
}
catch (IllegalArgumentException iae){
}
DataElement elm = null;
elm = new DataElement(DataElement.DATSEQ);
elm.addElement(new DataElement(
DataElement.UUID,new UUID(0x1002)));
sr.setAttributeValue(0x0005,elm);
try {
local.updateRecord(sr);
} catch (ServiceRegistrationException e3) {
}
try {
conn = server.acceptAndOpen();
} catch (ServiceRegistrationException sre){
} catch (IOException e2) {
}
}
}
And this is part of the Android client:
package com.exampleproyect.stackoverflowclient;
import java.lang.reflect.InvocationTargetException;
import java.util.UUID;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.ParcelUuid;
import android.os.Parcelable;
public class StackOverFlowClientActivity extends Activity {
BluetoothAdapter mBluetoothAdapter;
BluetoothDevice C702;
BroadcastReceiver mReceiver;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
C702 = mBluetoothAdapter.getRemoteDevice("00:23:F1:27:16:DA");
C702.fetchUuidsWithSdp();
mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context arg0, Intent intent) {
String action = intent.getAction();
if (BluetoothDevice.ACTION_UUID.equals(action)){
Parcelable[] uuidExtra = intent.getParcelableArrayExtra("android.bluetooth.device.extra.UUID");
}
}
};
IntentFilter filter1 = new IntentFilter(BluetoothDevice.ACTION_UUID);
registerReceiver(mReceiver, filter1);
}
}
What bothers me the most is that my computer can correctly expose my JAVAME server:

?:( Bluetooth- Bluetooth , JAVAME, Android ? Android Bluetooth JAVAME?
, StackOverFlow, .: (
Sony Ericsson C702 (Java Platform 8) . Samsung Galaxy S (ICS 4.0.3, ICSSGS RC4.2)
EDIT1
OK.
, .
, JAVAME UUID (): "68EE1418-12D2-11D7-8EED-00B0D03D76EC", , :
conURL = "btspp://localhost:68EE141812D211D78EED00B0D03D76EC;"
+ "authenticate=false;encrypt=false;name=MySampleApp";
server = (StreamConnectionNotifier)
Connector.open(conURL);
ServiceClassIDList UUID "00001101-0000-1000-8000-00805F9B34FB" :

, Android BluetoothDevice.fetchUuidsWithSdp();
, UUID "00001101-0000-1000-8000-00805F9B34FB" , UUID "68EE1418-12D2-11D7-8EED-00B0D03D76EC", Serial Port .
Medieval Bluetooth Network Scanner, , "00001101-0000-1000-8000-00805F9B34FB" :

, UUID, JAVAME ?
, , !
EDIT2
, Sony Ericcson. -, UUID {0x1101} UUID, Samsung Nokia, , UUID . Android, , 0x001 , , , .
, :
- API Android servicerecord ServiceClassID (0x001)?
servicerecord, Discovery Services (SDDB) "acceptAndOpen" -JAVAME-? - LocalDevice.updateRecord , SDDB, , .