List of usage examples for android.bluetooth BluetoothAdapter getDefaultAdapter
public static synchronized BluetoothAdapter getDefaultAdapter()
From source file:Main.java
public static String getMacAddress() { return BluetoothAdapter.getDefaultAdapter().getAddress(); }
From source file:Main.java
public static BluetoothAdapter getBluetoothAdapter() { return BluetoothAdapter.getDefaultAdapter(); }
From source file:Main.java
public static boolean getBluetoothIsOpen() { BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); return adapter.isEnabled(); }
From source file:Main.java
public static boolean isBluetoothOn() { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); return bluetoothAdapter != null && bluetoothAdapter.isEnabled(); }
From source file:Main.java
public static boolean isHaveBluetooth() { BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter == null) return false; else/* w w w. ja va2 s .c o m*/ return true; }
From source file:Main.java
public static boolean getBluetoothIsConn() { BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter.getBondedDevices().size() > 0) return true; return false; }
From source file:Main.java
public static void offBluetooth() { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter.isEnabled()) { bluetoothAdapter.disable();/*from w ww .j a va2s . co m*/ } }
From source file:Main.java
public static void enableBluetooth() { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter != null && !bluetoothAdapter.isEnabled()) { bluetoothAdapter.enable();//from w w w .j av a2 s. c o m } }
From source file:Main.java
public static void disableBluetooth() { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter != null && bluetoothAdapter.isEnabled()) { bluetoothAdapter.disable();//from w ww . j av a2 s. c om } }
From source file:Main.java
public static void stopBluetooth() { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter != null) { if (bluetoothAdapter.isEnabled()) { bluetoothAdapter.disable();//from w w w. j a va 2 s .c o m } } }