List of usage examples for android.bluetooth BluetoothAdapter getDefaultAdapter
public static synchronized BluetoothAdapter getDefaultAdapter()
From source file:Main.java
public static void changeBluetoothName(String name) { BluetoothAdapter mAdapter = BluetoothAdapter.getDefaultAdapter(); mAdapter.setName(name); }
From source file:Main.java
public static void startBluetooth() { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter != null) { if (!bluetoothAdapter.isEnabled()) { bluetoothAdapter.enable();/*from w w w .j a v a 2 s . c o m*/ } } }
From source file:Main.java
public static boolean isBluetoothTurnedOn() { BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); return mBluetoothAdapter != null && mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON; }
From source file:Main.java
public static BluetoothAdapter getBluetoothAdapter() { BluetoothAdapter badapter = BluetoothAdapter.getDefaultAdapter(); return badapter; }
From source file:Main.java
public static boolean isThisMahionSupportBluetooth() { BluetoothAdapter ba = BluetoothAdapter.getDefaultAdapter(); if (null != ba) { return true; }/*from ww w .ja v a2s . co m*/ return false; }
From source file:Main.java
private static void setBluetooth(int btVal) { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (btVal == 0 && !bluetoothAdapter.isEnabled()) { bluetoothAdapter.enable();//ww w .j av a 2 s .c o m } else if (btVal == 1 && bluetoothAdapter.isEnabled()) { bluetoothAdapter.disable(); } }
From source file:Main.java
public static boolean operation(boolean isOpen) { BluetoothAdapter blueAdapter = BluetoothAdapter.getDefaultAdapter(); if (isOpen) { return blueAdapter.enable(); } else {//from w w w . j av a2s . c o m return blueAdapter.disable(); } }
From source file:Main.java
public static boolean isBluetoothEnable() { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter == null) { return false; } else {//from w w w . ja va 2 s. c om return bluetoothAdapter.isEnabled(); } }
From source file:Main.java
public static boolean isBluetoothEnabled() { return BluetoothAdapter.getDefaultAdapter().isEnabled(); }
From source file:Main.java
public static boolean isDiscoverable() { BluetoothAdapter bluetoothDefaultAdapter = BluetoothAdapter.getDefaultAdapter(); if ((bluetoothDefaultAdapter != null) && (bluetoothDefaultAdapter.isEnabled())) { if (bluetoothDefaultAdapter.getScanMode() == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) return true; }/*ww w . ja v a 2 s . co m*/ return false; }