简体   繁体   English

在Android中激活蓝牙SPP?

[英]Activate Bluetooth SPP in Android?

I am trying to use Bluetooth SPP to communicate over it.我正在尝试使用蓝牙 SPP 通过它进行通信。 In some Android phones, SPP profile is not activated.在某些 Android 手机中,SPP 配置文件未激活。 I faced the problem in the application that SPP was not activated and so the connection could not be established over bluetooth and when I started another app that is 3g hotspot which I think activates SPP and I was able to connect over bluetooth in my app.我在应用程序中遇到了 SPP 未激活的问题,因此无法通过蓝牙建立连接,当我启动另一个我认为激活 SPP 的 3g 热点应用程序时,我能够在我的应用程序中通过蓝牙连接。

So, how can we actually activate SPP profile of bluetooth in Android devices?那么,我们如何才能真正激活 Android 设备中蓝牙的 SPP 配置文件呢? And does all the android devices has SPP profile?是否所有的 android 设备都有 SPP 配置文件?

In developer.android.com BluetoothSocket :在 developer.android.com BluetoothSocket 中

The most common type of Bluetooth socket is RFCOMM, which is the type supported by the Android APIs.最常见的蓝牙套接字类型是 RFCOMM,这是 Android API 支持的类型。 RFCOMM is a connection-oriented, streaming transport over Bluetooth. RFCOMM 是一种面向连接的、基于蓝牙的流传输。 It is also known as the Serial Port Profile (SPP).它也称为串行端口配置文件 (SPP)。

This might answer your question .. https://source.android.com/devices/bluetooth/services这可能会回答您的问题.. https://source.android.com/devices/bluetooth/services

SPP (or ability to use Java API's to establish RFCOMM channels) is available from Android (2.0/2.1) release (Eclair) onwards从 Android (2.0/2.1) 版本 (Eclair) 开始提供 SPP(或使用 Java API 建立 RFCOMM 通道的能力)

On the Android phone you will probably need to run an application that initiates the service over SPP.在 Android 手机上,您可能需要运行通过 SPP 启动服务的应用程序。 ** **

public BluetoothServerSocket listenUsingRfcommWithServiceRecord (String name, UUID uuid) public BluetoothServerSocket listenUsingRfcommWithServiceRecord(字符串名称,UUID uuid)

** API can be used to create a service with specified UUID to listen, Doing this should make this service visible to other devices which can then connect to it. ** API 可用于创建具有指定 UUID 的服务以进行侦听,这样做应该使此服务对其他设备可见,然后可以连接到它。

I just called Samsung help regarding bluetooth SPP on an S8+ phone.我刚刚打电话给三星关于 S8+ 手机上的蓝牙 SPP 的帮助。 They tell me wait for Android Oreo as it isn't available till then.他们告诉我等待 Android Oreo,因为它在那之前不可用。 My previous Sony Xperia used Ntrip Client to talk to an external Geneq GPS to receive corrected coordinates and worked really well.我之前的 Sony Xperia 使用 Ntrip 客户端与外部 Geneq GPS 通信以接收校正后的坐标,并且运行良好。 Seems we went backwards somewhere?好像我们在某个地方倒退了? Ntrip client on the phone collects an internet data stream of GPS corrections every five seconds and sends these to the GPS.手机上的 Ntrip 客户端每五秒收集一个互联网 GPS 校正数据流,并将这些数据发送到 GPS。 The GPS uses the corrections and sends back adjusted coordinates to the phone to use in any application. GPS 使用修正值并将调整后的坐标发送回手机,以便在任何应用程序中使用。 I would appreciate someone brighter than me pointing out a quick fix I just load and run to bring back this functionality.我会感谢比我更聪明的人指出一个快速修复,我只是加载并运行以恢复此功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM