通过蓝牙将文件从手机传输到另一部手机

发布于 2024-08-05 17:39:35 字数 634 浏览 7 评论 0原文

我一直在寻找这个问题。仍然找不到解决办法。 基本上,我想通过 OBEX 推送服务(蓝牙)从客户端(j2me)将加密文件传输到服务器(j2me)。在模拟器中,它工作正常。客户端能够在服务器上成功执行蓝牙发现查找。

但是,当我将应用程序放入手机中时。它根本没有显示任何东西。我猜这可能是服务器或客户端 url 问题。

谁能帮助我吗?

这是我的一些代码(很可能是这导致了我的问题)。

(客户端)

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

(服务器)

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

我尝试用“001122333445566778899AABBCCDDEEFF”替换1105(在服务器中),但结果仍然相同。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱格式化 2024-08-12 17:39:35

您使用 UUID 的方式不正确。我很惊讶它甚至可以在模拟器中运行。

您需要像这样创建 UUID,

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

并在 searchServices 和 URL 中使用相同的 uuid。例如,

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

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";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文