Android BLE通知 [英] Android BLE Notification

查看:209
本文介绍了Android BLE通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用BLE开发一个android应用程序.我已经实现了所有基本操作,例如发现,连接和数据传输.

I'm developing an android application using BLE. I've implemented all the basic operations like discovery, connection, and data transfer.

现在我正在寻找BLE通知,当应用程序未运行时(甚至不是在后台),是否可以从BLE设备接收通知.

Now I was looking for BLE notifications, Is it possible to receive notification from BLE device when the application is not running (not even in background).

我要实现的是类似于GCM/FCM的通知,即使应用未运行,我们也会在我们的应用中收到通知. 因此,要检查BLE设备和Android框架是否支持类似的通知机制.

What I want to implement is the notification similar to GCM/FCM, we receive notifications in our app even though app is not running. So want to check if similar notification mechanism is supported by BLE devices and Android framework.

我已经搜索了几个小时,但没有得到任何适当的结果.

I've searched for few hours now but didn't get any proper result.

是否有人可以告诉我是否受支持?

If anyone can just tell me if it is supported or not?

推荐答案

我会拒绝.您需要运行该应用程序才能获取蓝牙回调.您只需在流程中设置一个前台服务,即可使该应用程序在后台运行.

I would say no. You need to have the app running to get Bluetooth callbacks. You should simply set up a Foreground Service in your process and that will keep the app running in the background.

这篇关于Android BLE通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆