I need to open up bluetooth through my code without asking the user to enable it and then discover all the devices in range and return those devices and then close bluetooth connection.
How to do it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I suppose here is exactly what you need.
https://developer.android.com/guide/topics/connectivity/bluetooth.html#FindingDevices
https://developer.android.com/guide/topics/connectivity/bluetooth.html#DiscoveringDevices
About enabling the Bluetooth without asking the user, here is what the doc says:
But if you really want to Enable device bluetooth without asking the user. after add this:
permission to your Manifest use this code in your App