I build a start stop with arduino and HC05 bluetooth. Anyone can show me how to add android permission to scan and connect a bluetooth?
To add the necessary permissions for scanning and connecting to Bluetooth devices in an App Inventor app, you’ll need to follow these steps:
- Open your project in App Inventor.
- Click on the “Designer” tab to access the visual designer interface.
- In the “Palette” panel on the left side, scroll down and locate the “Connectivity” section.
- Drag and drop the “BluetoothClient” component onto the screen.
- Click on the “Blocks” tab to access the blocks editor.
- From the “Connectivity” section in the blocks palette, locate the “BluetoothClient” blocks and expand them.
- Drag and drop the “RequestBluetoothPermission” block onto the blocks editor.
- Now, to add the required permissions, switch to the “Designer” tab again.
- Click on the “Screen1” component (usually located at the top of the “Components” panel).
- In the “Properties” panel on the right side, scroll down to the “Permissions” section.
- Click on the “Add…” button next to the “UsesPermissions” property.
- In the “Choose Permission” dialog, enter “android.permission.BLUETOOTH” in the search bar and select it.
- Click on the “Add…” button again and enter “android.permission.BLUETOOTH_ADMIN” in the search bar and select it.
- Finally, click on the “OK” button to close the “Choose Permission” dialog.
By following these steps, you have added the necessary permissions to your App Inventor project for scanning and connecting to Bluetooth devices. Remember to test your app thoroughly to ensure it functions as expected.