首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >与HM-10和温度传感器的BLE连接问题:使用Android studio版本3.1.4和API15的安卓应用程序:安卓4.0.3 (IceCreamSandwich)

与HM-10和温度传感器的BLE连接问题:使用Android studio版本3.1.4和API15的安卓应用程序:安卓4.0.3 (IceCreamSandwich)
EN

Stack Overflow用户
提问于 2018-09-24 02:20:34
回答 1查看 587关注 0票数 0

我必须设计一个安卓应用程序使用安卓工作室sdk版本3.1.4和开发API 15:安卓4.0.3 (IceCreamSandwich),能够接收csv数据从arduino使用HM 10BLE模块类似于playstore上的BLE终端应用程序。BLE终端App用于扫描附近的BLE设备,也可用于串行通信。通过您的智能手机控制使用任何BLE模块(基于德州仪器CC254x)的任何微控制器。此应用程序可以通过BLE发送和接收命令,因此您可以轻松调试您的硬件问题。以ASCII或HEX格式监控接收数据。以ASCII或HEX格式发送数据。目前我已经在android studio上导入了BluetoothLEGATT示例代码,并安装了应用程序,在该应用程序中,我正在获取数据,但数据不是流中来的,我希望它能在流中显示。我想收到csv格式的邮件。数据应该是流格式的。在arduino方面,我以csv格式发送。

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>

<!--Copyright 2013 The Android Open Source ProjectLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. -->

-<manifest android:versionName="1.0" android:versionCode="1" package="com.example.android.bluetoothlegatt" xmlns:android="http://schemas.android.com/apk/res/android">

<!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->


<!-- Declare this required feature if you want to make the app available to BLE-capabledevices only. If you want to make your app available to devices that don't support BLE,you should omit this in the manifest. Instead, determine BLE capability by usingPackageManager.hasSystemFeature(FEATURE_BLUETOOTH_LE) -->


<uses-feature android:required="true" android:name="android.hardware.bluetooth_le"/>

<uses-permission android:name="android.permission.BLUETOOTH"/>

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>


-<application android:theme="@android:style/Theme.Holo.Light" android:icon="@drawable/ic_launcher" android:label="@string/app_name">


-<activity android:name=".DeviceScanActivity" android:label="@string/app_name">


-<intent-filter>

<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>

</intent-filter>

</activity>

<activity android:name=".DeviceControlActivity"/>

<service android:name=".BluetoothLeService" android:enabled="true"/>

</application>

</manifest>
EN

回答 1

Stack Overflow用户

发布于 2018-09-26 17:22:04

蓝牙低能耗(BLE)是在4.3版本中引入Android的。所以你的问题之一可能是API15:Android4.0.3 (IceCreamSandwich)。尝试将最小API改为18。在API级别21之前,棒棒糖android使用的是BlueZ软件堆栈。尽管BlueZ可以工作,但它在Android4.3上的BLE仍然存在一些稳定性问题,特别是在维护连接方面的扫描。在Android API 21版本中,使用了Bluedroid软件堆栈,该软件堆栈更加稳定,并改进了BLE的API。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52469005

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档