最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【整理】Android中蓝牙通过OPP传输文件的app的代码分析

Bluetooth crifan 3084浏览 0评论

Android中的,蓝牙方面的文件传输的app的源码,是从:

GC: BluetoothShare – com.android.bluetooth.opp.BluetoothShare (.java) – GrepCode Class Source

->

GC: android-apps-2.2_r1.1.jar – GrepCode Java Project Source

->

Source download: android-apps-2.2_r1.1-sources.jar

而下载到的源码,解压后可以得到OPP的那个app的源码:

downloaded android-apps-2.2_r1.1-sources code

然后建立了个SourceInsight项目,去研究代码。

 

研究了半天,终于找到最终发送文件数据的地方了:

BluetoothOppObexClientSession.java

->

private int sendFile(BluetoothOppSendFileInfo fileInfo) 

->

outputStream.write(buffer, 0, readLength);

就是这句,是真正触发文件的数据发送的。

BluetoothOppObexClientSession sendFile outputStream write

 

【总结】

对于安卓中的蓝牙的:

一个普通的文件发送的大概流程是:

BluetoothOppObexClientSession.java

public void run()

->

private void doSend() 

->

private int sendFile(BluetoothOppSendFileInfo fileInfo)

转载请注明:在路上 » 【整理】Android中蓝牙通过OPP传输文件的app的代码分析

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.174 seconds, using 22.06MB memory