Get the App
SLTechnology News&Howtos  ›  Development  › 

Android device Bluetooth connection scan gun how to get the scan content

Shulou Source: shulou.com Published: 2022-06-03 09:14:53 11月14日 Update

Editor to share with you the Android device Bluetooth connection scan gun how to get the scan content, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. Bluetooth pairing

Open the system settings, Bluetooth paired scanning gun, the general scanning gun instructions are written, after the pairing is completed, it shows that it is connected

Configure permissions in 2.AndroidManifest

Configure the permissions required for a Bluetooth connection in

3. Get device information and determine whether it is connected or not

Here the device type returned by the Bluetooth device is BluetoothClass.Device.Major.PERIPHERAL

/ * whether the scanning gun is connected to * @ return * / public boolean hasScanGun () {if (mBluetoothAdapter = = null) {return false;} Set blueDevices = mBluetoothAdapter.getBondedDevices (); if (blueDevices = = null | | blueDevices.size () = KeyEvent.KEYCODE_A & & keyCode = KeyEvent.KEYCODE_0 & & keyCode

Tags: Bluetooth device scan gun event content function article result input size method permission system part delay configuration success not much code name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Docker vpn Redmi MySQL