Sending files from my PC (using the OS's bluetooth send app.) to my phone's J2ME app.
Hi,
I have created an application that can send and receive files via OBEX. I have sent files to other mobile phones. And in the emulator, I have demonstrated my application's ability to receive files from a copy of the application which sends a file. I can also send files from my phone to my PC without problems.
However, even though I can receive files from another copy of my application in the emulator, when I try to send a file from my PC, using the standard bluetooth send utilities, to my application the application does not register the connection. My phone displays its standard receive file dialogue, completely missing out my application.
I cannot decide if it's a problem with my phone - I doubt it - or my server side code not registering itself properly, and hence why the phone deals with the incoming connection and not my application.
My server side code looks like this:
Code:
this.localDevice = LocalDevice.getLocalDevice();
localDevice.setDiscoverable(DiscoveryAgent.GIAC);
SessionNotifier sc =
(SessionNotifier) Connector.open("btgoep://localhost:" +
new UUID(0x1105).toString() + //i've tried 1106 here as well
";name=Hi;authorize=false");
ServiceRecord sr = localDevice.getRecord(sc);
System.out.println("starting server");
Connection c = sc.acceptAndOpen(new Handler(this.callback));
All I can think is that the UUID, which is set to OBEX, (see here: http://ants.dif.um.es/~felixgm/docen...ooth/UUID.html) is wrong somehow, or that I need some more UUIDs so the application picks up all incoming connections, but I know very little about this subject and my research has come to somewhat of a dead end.
Any thoughts?