views:

170

answers:

1

I try to create a MIDlet that provides a publically availabe service but the code below is not enough. The service is on (no exceptions) but stil not discowerable.

public StreamConnection waitForConnection() throws IOException {

    if (this.notifier == null) {
        // Create a server connection (a notifier)
        this.notifier = (StreamConnectionNotifier) Connector.open(serviceURL);
    }
    return this.notifier.acceptAndOpen();
}

the url is contructed as follows

private final static String serviceURL = "btspp://localhost:" + servieceUUID +
        ";name=" + serviceName + ";authenticate=false;master=false;encrypt=false";

After some googling i found that a code like this hould help:

        final ServiceRecord sr = LocalDevice.getLocalDevice().getRecord(this.notifier);
        //Public browse group UUID
        final DataElement element = new DataElement(DataElement.DATSEQ);
        element.addElement(new DataElement(DataElement.UUID, new UUID(0x1002)));
        sr.setAttributeValue(0x0005, element);
        LocalDevice.getLocalDevice().updateRecord(sr);

but first it doesn't solve the problem and second i've got no idea what it actually does.

I use Nokia E70.

Any ideas ?

Thanks in advance.

A: 

Did you try to use setDiscoverable method?

Wonil
Jup - simply forgot to put it in a code sample bu it's there :)
lbownik