Hello Shruti
In the future, please do not enclose your information in a .docx file - just place the images directly in your Post.
There is a lot missing from your Blocks before scanning can start, plus no safeguarding.
1) Ensure that the phone has Bluetooth switched on, and ensure the micro bit is on too.
We can use Classic Bluetooth to switch the phone's Bluetooth on, via Activity Starter.
2) For Android API level > 22, the phone must have Location switched on. Currently, we need to Use Taifun's 'Taifun Tools' extension if we have to verify API level:
If your App is only for your own use on your own phone, this verification step is unnecessary because you can code to suit your phone only. You can find out what level your phone is from the chart on my website here:
3) Trap errors with the Screen . Error Occurred Block:
Now, even as the User of your own App, you are tapping buttons that should not be tapped because the process isn't ready - you shouldn't be able to tap a "connect" button until a device has been selected. If you think about it, a connect button is not required - you can start the connection when the User selects a device from the device list.
I can't give you example code for Location without knowing if the App is for your phone only or will be used on other phones too, because it involves security permissions and how to handle them each time the App is launched. So let me know here! However, for your experiment in getting the phone and device connected, you can switch on Bluetooth and if necessary, Location.
Using code to ensure the phone's Bluetooth is switched on:
