Android 蓝牙 OPP文件传输-Obex协议连接-socket连接 从framework到协议栈btif层 --- 全网最详细(一)

同学,别退出呀,我可是全网最牛逼的 Android 蓝牙分析博主,我写了上百篇蓝牙文章,请点击下面了解本专栏,进入本博主主页看看再走呗,一定不会让你后悔的,记得一定要去看主页置顶文章哦。

一、概述

        今天我们将开一个新的专题 --- OPP文件传输协议,众所周知,蓝牙OPP协议用来手机之间传输文件,虽然我们日常生活中不常用这个功能了,但是作为一名专业蓝牙开发者,还是得熟悉这个协议的源码流程,方便处理OPP相关问题。

二、源码分析

        Android手机点击某文件进行蓝牙分享的时候,会跳转到系统自带应用Bluetooth中。
具体文件:packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppLauncherActivity.java
看一下BluetoothOppLauncherActivity是如何处理分享文件请求的。

public void onCreate(Bundle savedInstanceState) {
。。。。。。
if (action.equals(Intent.ACTION_SEND) || action.equals(Intent.ACTION_SEND_MULTIPLE)) {
            //Check if Bluetooth is available in the beginning instead of at the end
            if (!isBluetoothAllowed()) {
                Intent in = 

猜你喜欢

转载自blog.csdn.net/weixin_45534242/article/details/125231879