English 中文(简体)
OBEX OPP特定转移
原标题:OBEX OPP Specific transfer

I am developing an OBEX OPP client application in android phone.Through the client application i will send an object to the non Android device (which will act as the OPP server).I have created the RFCOMM socket connection using the API

createRfcommSocketToServiceRecord(OPP_UUID); I have use the UUID of the OBEX Push i.e.

private static final UUID OPP_UUID = UUID .fromString("00001105-0000-1000-8000-00805F9B34FB");

I have observed that through this the socket connection is successful and I got the input and output stream of the socket to send and recieve the data.But when I send the data the data recieved the other device is not in the right format. What I mean by this is in the reciever device the data is recieved with the error. BT Air sniffer indicates that the in the retrieved_opcode Data is not present.OBEX response code is Bad request.

Can anyone guide me what is wrong in this ? or the steps to make an OBEX OPP connection with the device which is not paired.

你的宝贵意见将帮助我克服这一困难。

Thanks, Shekhar

问题回答

你应该能够配对设备,你也可以通过设备上的蓝牙设置进行配对,但你不能像SPP通信那样直接连接和发送数据。

OBEX是一种协议,有自己的报头、数据包等。。

在安卓系统中,没有一个API可以通过OBEX进行通信,您可以通过编程进行使用。(您可以连接到设备,但之后您只能读取/写入字节)。

您可以通过obex通过以下几种方式将文件发送到配对设备:

使用ACTION_SEND意图,将弹出一个菜单,其中包含可以处理您想要发送的文件类型的应用程序,用户需要从中选择蓝牙,然后选择设备。

Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
share.putExtra(Intent.EXTRA_STREAM, Uri.parse(SDCardPath + "file.jpg"));
startActivity(Intent.createChooser(share, "Share Image"));

或者你可以使用另一种方法,如果你不想在你的应用程序中有任何对话框,请检查以下问题,它有一个可用解决方案的更新:

使用蓝牙OBEX对象推送配置文件(OPP)发送文件





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签