Android蓝牙下载文件时提示不一致

发布于 2024-11-17 01:50:21 字数 956 浏览 5 评论 0原文

我们正在编写一个应用程序,其中数字笔与 Android 设备配对,然后笔将文件上传到 Android 设备。我们在不同设备之间存在不一致的行为,并且希望有一个一致的解决方案。 理想情况下,我们会拦截传入的文件并管理应用程序内的二进制数据。

  • 在 Galaxy S (2.2) 和 Galaxy Tablet (2.2) 上,当通过蓝牙接收到文件时,它会提示用户接受该文件,但在该阶段它包含一个复选框,以便从那时起自动接受该文件。
  • 在 HTC Desire (2.2) 上,当从数字笔发送文件时,系统会提示用户,但用户必须在每次发送文件时手动接受文件。如果用户没有及时接受,文件就会丢失。

我们想要的是一致的行为,用户不需要手动接受每个文件。

我们还尝试了多种解决方案,例如

  • 监听传入文件的蓝牙连接、
  • 实现我们自己的 BroadcastReceiver
  • 以及尝试让 Android 设备充当蓝牙服务器,然后手动拦截文件。 (类似于 BluetoothChat 示例应用程序)

.​​..但没有任何运气。我们能够从蓝牙意图触发活动,但 OBEX 文件传输似乎发生在 Android 设备工作的较低级别,并且无法被拦截。

我们还存在一个问题,即标准蓝牙/OBEX 实现会写入不同的位置,具体取决于

  • 的供应商 /mnt/sdcard/bluetooth
  • 三星/mnt/sdcard/Downloads/bluetooth > 对于 HTC。

...但这是一个较小的问题,并且可以通过首选项进行管理。

We are writing an application where a digital pen is paired with an android device, then the pen uploads a file to the Android device. We have inconsistent behaviour between different devices and would like a consistent solution. Ideally we would intercept the incoming file and manage the binary data within the application.

  • On a Galaxy S (2.2) and Galaxy Tablet (2.2), when a file was received via Bluetooth it would prompt the user to accept the file, but at that stage it includes a checkbox so that the file is automatically accepted from then on.
  • On a HTC Desire (2.2) the user is prompted when the file is sent from the digital pen, but the user must manually accept the file each time one is sent. If the user doesn't accept in time then the file is lost.

What we would like is consistent behaviour where the user does not need to manually accept each file.

We have also tried several solutions such as

  • listening for incoming files Bluetooth connections,
  • implementing our own BroadcastReceiver,
  • and attempting to get the Android device to act as a Bluetooth server and then manually intercept the file. (similar to the BluetoothChat sample application)

... but without any luck. We are able to trigger an Activity from a Bluetooth intent, but it appears that the OBEX file transfer occurs at a lower level within the workings of the Android device and not able to be intercepted.

We also have the issue that the standard Bluetooth/OBEX implementation writes to a different location depending on the vendor

  • /mnt/sdcard/bluetooth for Samsung
  • /mnt/sdcard/Downloads/bluetooth for HTC.

... but this is a lesser problem and able to be managed via preferences.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文