简体   繁体   中英

transfer file from mobile phone to another via bluetooth

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM