Disconnect action is used to disconnect your application from the Bluetooth device it is connected to. Disconnecting the connection stops data transmission and terminates notifications from the device. After this process, the user can connect to a new device or reconnect to the same device.
Technical Features
1. Creating a Bluetooth Datasource
2. Creating a Bluetooth Method
3. Adding the Disconnect Action
Parameter Definitions
This action works directly through the previously defined Bluetooth data source. No additional parameters are required. However, the connection must be established beforehand.
In a sports app, when the user completes a sports activity, data transfer from the device should be stopped and the Bluetooth connection should be terminated. This preserves the device's battery and makes the app ready to connect to other devices.
1. Go to the UI Design module.
2. When this button is clicked, add the following action from the + ADD ACTION menu to disconnect the connection:
3. To send a notification to the user as the next action:
With this flow, when the user clicks the “Disconnect” button, the Bluetooth connection with the device is terminated and an informative message is displayed on the screen.
Technical Risks and Precautions
The Disconnect action enables you to perform controlled connection terminations in features that use Bluetooth in your application. It provides safe and effective use in critical processes such as switching between devices, energy management, and preventing connection errors.