简体   繁体   English

如何通过Android应用程序过滤蓝牙标签

[英]How to filter bluetooth tags through android apps

How to filter bluetooth tags in times of pairing with apps. 与应用配对时如何过滤蓝牙标签。 For instance, "Tile" doesn't connect with tags other than their authorized tags. 例如,“瓷砖”不与除其授权标签以外的其他标签连接。 My question is, how do they recognize their authorized tags through apps? 我的问题是,他们如何通过应用识别他们的授权标签?

A simple solution is to connect to an untrusted device, send a signal with an specific result expected, if it receives fine, then "trust" that device. 一种简单的解决方案是连接到不受信任的设备,发送预期具有特定结果的信号,如果接收良好,则“信任”该设备。

Then, on next loads, check the paired MAC address.. 然后,在下次加载时,检查配对的MAC地址。

Something akin to: 类似于:

private BluetoothDevice mDevice = null;
if (mDevice == null) {
        BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        if (mBluetoothAdapter != null) {
            if (mBluetoothAdapter.isEnabled()) {
                Set<BluetoothDevice> bluetoothDevices = mBluetoothAdapter
                        .getBondedDevices();
                if (bluetoothDevices != null && bluetoothDevices.size() > 0) {
                    String bondedID = SharedPreferences.getInstance(
                            getApplicationContext()
                    ).getPairedAddress();
                    if (bondedID != null) {
                        for (final BluetoothDevice device : bluetoothDevices) {
                            if (device != null
                                    && device.getAddress().equals(bondedID)) {
                                mDevice = device;
                                break;
                            }
                        }
                    }
                } else {
                    Logger.v(TAG, "There are no Bluetooth Paired devices");
                }
            }
        }
    }

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

相关问题 如何通过配置更改在Android上管理蓝牙连接? - How to manage a Bluetooth connection on Android through configuration changes? Android蓝牙LE蒙面UUID过滤器 - Android Bluetooth LE Masked UUID Filter Android 上的蓝牙 - 如何连接到正确的蓝牙设备? - Bluetooth on Android - how to connect to the CORRECT bluetooth device? 在android中通过蓝牙发送文件时出错? - Error while sending files through bluetooth in android? Android-以编程方式通过蓝牙发送图像 - Android - send image through bluetooth programmatically 通过蓝牙接收的消息在android应用程序中拆分 - Received message through Bluetooth is splitted in android app 如何通过Android蓝牙串口RFCOMM将串行通信转储为文件 - How do I dump serial communication as file through Android bluetooth serial RFCOMM 如何通过蓝牙将数据包发送到另一个启用蓝牙的设备 - How to send a packet through Bluetooth to another Bluetooth enabled device 如何通过Google Cloud Endpoints将两个Android应用连接到同一App Engine数据存储区? - How to connect two Android apps through to the same App Engine Datastore through Google Cloud Endpoints? 如何在Android中连接蓝牙设备? - How to connect the Bluetooth device in Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM