Recipe Turning on Bluetooth

Bluetooth is initialized using the BluetoothAdapter class.The getDefaultAdapter() method retrieves information about the Bluetooth radio interface. If null is returned, it means the device does not support Bluetooth:

BluetoothAdapter myBluetooth = BluetoothAdapter.getDefaultAdapter();

Activate Bluetooth using this BluetoothAdapter instance to query the status. If not enabled, the Android built-in activity action_request_enable can be used to ask the user to start Bluetooth:

if(!myBluetooth.isEnabled()) {

Intent enablelntent = new Intent(BluetoothAdapter



Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook

Post a comment