If you are a device manufacturer or a developer who is developing an application that can work with a specific device (such as a wearable device or IoT application), when you and your end user pair the device with an Android phone, use The Fast Pair service can help you reduce your workload.
In fact, you don’t need to code to enable Fast Pairing unless you want to handle the pairing operation in your companion app instead of letting the API help you complete the pairing.
There are only three steps in the pairing process:
- Make sure that your peripheral device meets all registration requirements.
- The device model has been registered with Google.
- When users need to pair, your device will appear on their phone. (As shown in Figure 1, the information collected in step 1 will be displayed to the user).
△ Figure 1: Fast Pair connection notification
Once the user has set your peripheral device to pairing mode, a dialog box will pop up at the bottom of their Android phone interface, displaying the device name, device photo, and a Connect button (as shown in Figure 1).
Your users only need to click this button to pair their devices, and then they can enjoy a pleasant and relaxing experience.
Fast Pair service also enables users to locate misplaced devices through their mobile phones, and even displays the battery level of true wireless stereo headsets (TWS).
Finally, Fast Pair can prompt the user to install any application that can be used with the device.
Prerequisites for
To ensure that your device can run Fast Pair correctly and provide a better user experience, the following conditions need to be met:
Personal Privacy & Bluetooth Low Energy (BLE)
To protect your privacy and prevent users being tracked, we require the use of equipment with random resolvable private address (RPA) of low-power Bluetooth (BLE).
The address needs to be updated every 15 minutes and at the beginning of each Advertisement Session. But do not switch the address in the pairing mode; switching the address will prevent the establishment and maintenance of the connection, because the connection will be disconnected when the address fails.
Account key
Fast Pair uses a different account key (Acount Key) to represent different individual users of peripheral devices. The account key can be mapped to a Gmail address.
Your peripheral device needs to store at least five account keys so that multiple people can use the same device at the same time. For example, parents and children in a family can share a car, and everyone will use their Gmail address as an account key.
As an additional feature, if a person uses the same Gmail account on multiple Android phones or tablets, it will also be treated as an account key by the Fast Pair service. Therefore, if ten different Android devices share the same Gmail account, for Fast Pair, your peripheral devices will not be distinguished, and it will recognize these devices as the same user.
BLE GATT
Your device needs to support the BLE GATT profile with Services and Characteristics.
When using Fast Pair, you need to define a service with a UUID of 0xFE2C and the following custom Characteristics :
- Model ID
- Key-based Pairing
- Passkey
- Account Key
The above are all supplements to the standard Characteristics and any custom characteristics (which can be used for communication with supporting applications).
If you have a companion app and have installed it on the hub device, your customized data will be forwarded to the app. Otherwise, the custom data will be ignored directly.
You can choose to register com.google.android.gms.nearby.fastpair.ACTION_LOG_BUFFER_FULL
whose ACTION is 061541d0cf38ca in the BroadcastReceiver
. This is optional, because when using this function, your peripheral device needs to inform the central device that the data buffer is full-this means that the peripheral device's firmware and supporting applications need to do some work to perform arbitrary processing on the data.
headset device
Fast Pair is often used in headset equipment, and this type of equipment needs to support A2DP or HFP. As long as the device supports one of these specifications, Fast Pair will first try to connect to A2DP and then HFP after the device is bound.
For TWS headsets, the following conditions need to be met:
- The broadcast content contains the power information of the device.
- The user can customize the device name.
Although these are not necessary for other peripherals, Fast Pair also supports and strongly recommends meeting these conditions.
A device with supporting applications
Fast Pair has a more general supporting application startup process to support various supporting devices. In this process, Fast Pair can only find the closest device, check the supporting application of the device (if the application is not installed, prompt the user to install), and guide the user to the designated interface of the supporting application. This process does not involve BT binding.
FitBit uses this process to simplify the process of configuring their devices. Another example of a device that uses this process may be a smart scale or an electric toothbrush, which can be used to showcase its supporting applications and simplify the out-of-the-box experience.
△ Figure 2: Supporting equipment setting guide
two-way communication
Although broadcasting is a one-way communication, once your device is successfully connected to a hub device, such as an Android phone, two-way communication becomes possible.
Fast Pair provides a RFCOMM channel ) for your peripheral equipment to maintain continuous communication with the central equipment. Once the connection is successful, it is completely fine to switch to classic Bluetooth for two-way communication.
registered
You need device models registered in Google is Fast Pair Provider .
Fast Pair Provider is a peripheral device (such as a pair of headphones) that can send broadcasts that can accept pairing.
Conversely, Fast Pair Seeker is a central device—for example, an Android phone or tablet, which looks for other devices for pairing. The Google Play services framework handles this part of the work and does not require other modules to perform any operations, so the content will not be introduced here.
In order to register your peripheral device, you only need to provide the following:
- Equipment name
- Equipment pictures
- Transmit power (
TxPower
) of measurement
Although the name and picture of the device are simple, measuring power requires more effort. We recommend that you measure the signal strength of the Bluetooth device one meter away from the Android phone, and then add 41dBm to the test result.
- For Eddystone-UID information, see here .
There are two options for submitting TxPower
: You can submit it manually during registration, or your device can include it as part of the load data during device broadcast.
If you provide TxPower
the equipment during registration, all equipment units you submit will be calibrated to an accurate TxPower
level. On the other hand, if you decide to include the TxPower
information as part of the broadcast record, the TxPower
level will be processed on a per-unit basis.
Once the registration is completed, we will provide you with a Model ID and an encrypted public/private key pair. As with any asymmetric encryption system, we strongly recommend that you store the private key in a secure element (SE) on the device so that attackers cannot access it.
- For asymmetric keys, please refer to: " From Encryption to Verification, All-round Protection of the Communication Security of Your Application "
The Advertisement Record of your device during the broadcast must include the Model ID provided by Google and the TxPower level of the device (if you haven't provided it at the time of registration).
Conclusion
Fast Pair is a service provided by Google as part of the Google Play service to simplify the device pairing process for Android users. In addition to making pairing more convenient, Fast Pair also provides some other great features, including helping users locate the misplaced device and prompting the device to install the corresponding supporting application. In order to provide users with the best experience, although there are some prerequisites, the registration process itself is very simple, because it only needs to provide the device name and picture.
Welcome to click here to submit feedback to us, or share your favorite content or problems found. Your feedback is very important to us, thank you for your support!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。