蓝牙文件传输 [英] Bluetooth File Transfer

查看:140
本文介绍了蓝牙文件传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发基于蓝牙聊天示例从 Android开发蓝牙应用网站。我需要做的通过蓝牙文件传输。任何人可以帮助我吗?

I am developing a Bluetooth application based on the Bluetooth Chat Example from the Android Developer Site. I need to do File Transfer via Bluetooth. Can anybody help me out?

推荐答案

在的情况下传输文件,你可以进行显式调用使用意图,以ACTION_SEND如下图所示。

In case of transferring the files you can make an explicit call to ACTION_SEND using intents as shown below.

您可以通过OBEX在几个方面文件发送到配对设备:

You can send a file to a paired device through obex in a couple of ways:

随着 ACTION_SEND 的意图,即会弹出一个菜单,可以处理你要发送的文件类型,从用户需要选择蓝牙的应用,然后该设备

With the ACTION_SEND intent, that will popup a menu with the application that can handle the file type you want to send, from which the user will need to select bluetooth, and then the device.

Intent i = new Intent(Intent.ACTION_SEND); i.setType("image/jpeg");    
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("/sdcard/file.jpg")); 
startActivity(Intent.createChooser(i, "Send Image"));

我认为这将帮助ü。 :)

I think this will help u . :)

这篇关于蓝牙文件传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆