transfer file from mobile phone to another via bluetooth

2.2k Views Asked by At

I've been searching high and low on this problem. Still can't find the solution. Basically, I want to transfer an encrypted file via OBEX Push Service (bluetooth) from client (j2me) to server (j2me). In emulator, it works fine. Client able to successfully do a bluetooth discovery lookup on the server.

But, when I put the application inside my phone. It doesn't show anything at all. I guess it might be a server or client url problem.

Can anyone help me?

Here's some of my code (most probably is this that cause my problem).

(Client)

discoveryAgent.searchServices(null,new UUID[] { new UUID(1105) },
  (RemoteDevice) list.getRemoteDevices().elementAt(i), this);

(Server)

sn = (SessionNotifier) Connector.open(
  "btgoep://localhost:1105;name=ObexPushServer;authenticate=false;master=false;encrypt=false");

I tried replacing 1105 (in the server) with "00112233445566778899AABBCCDDEEFF", but still the same result.

1

There are 1 best solutions below

1
On

The way you use UUID is incorrect. I am surprised it even works in emulator.

You need to create UUID like this,

UUID uuid = new UUID("1105", true);

and use the same uuid in searchServices and URL. For example,

String url = "btgoep://localhost:" + uuid + ";name=ObexPushServer;authenticate=false;master=false;encrypt=false";