Thursday, April 26, 2018

Can I restart Bluetooth from the terminal?


I have a rooted Galaxy S 2 (I9100) and was wondering if I can restart the Bluetooth on my phone via the terminal client on my phone.



Answer



The following terminal command should enable Bluetooth via adb shell or Terminal Emulator app:


su
am start -a android.bluetooth.adapter.action.REQUEST_ENABLE


On most versions of Android, this command will present a pop-up window to the user asking to confirm request to enable BT. I believe this was done for security purposes whenever an app that is not system is toggling BT.


I haven't found a way to disable BT via a shell command unfortunately.


With WiFi it's a lot easier, and does not prompt user for permission:


su
svc wifi enable

will turn it on, and


su
svc wifi disable


will turn it off.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...