I am trying to make an application like "Bluetooth auto tethering" on play store. I read on the forum that Android is very security-aware and will not enable this setting without user interaction.
I need some explanations about how enable bluetooth tethering.
Thank you
I don't know if this is still an issue or not, but I found that using the
connect
method in the reflection call works. Working off of the code that pmont used from the link in Lorelorelore's answer:Of course, this assumes that the bluetooth is enabled, and you only have one paired device. But enabling bluetooth is pretty straightforward using standard (not reflection) calls, and you can just check for the paired device that you want to connect to in the
for
loop. Also, don't forget theBTPanServiceListener
class from the other answer as well.Hope this helps.
Here you find a similar question: Bluetooth question
Just replace "isTetheringOn" with "setBluetoothTethering" in the reflection call and pass in a boolean parameter. It should work.
The below code works perfectly for me
The solution above required some modification in order to work for me. Specifically, the code to enable tethering needs to be in the OnServiceConnected() method. Also I have the following permissions set in the manifest:
Here is my solution: