Hi,
I am writing some code for android using python. I want to control the visibility of bluetooth ( i.e on or off of the bluetooth visibility) using some python script. Can you please help me ?

Recommended Answers

All 2 Replies

All the Info you need, is accessible through the API documentation: menu > help > API help > bluetooth facade.

from android import Android

droid = Android()

check = droid.checkBluetoothState().result
if check != 1:
    droid.toggleBluetoothState(1,0)
    print "Bluetooth turned ON!"
    droid.bluetoothMakeDiscoverable(300)
    print "Bluetooth is Discoverable for 300sec now"

else:
    droid.toggleBluetoothState(0,0)
    print "Bluetooth turned OFF!"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.