/** * Get the bond state of the remote device. * * <p>Possible values for the bond state are: {@link #BOND_NONE}, {@link #BOND_BONDING}, {@link * #BOND_BONDED}. * * <p>Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return the bond state */ public int getBondState() { try { return sService.getBondState(mAddress); } catch (RemoteException e) { Log.e(TAG, "", e); } return BOND_NONE; }
/** * Get the bond state of the remote device. * * <p>Possible values for the bond state are: {@link #BOND_NONE}, {@link #BOND_BONDING}, {@link * #BOND_BONDED}. * * <p>Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return the bond state */ public int getBondState() { if (sService == null) { Log.e(TAG, "BT not enabled. Cannot get bond state"); return BOND_NONE; } try { return sService.getBondState(this); } catch (RemoteException e) { Log.e(TAG, "", e); } catch (NullPointerException npe) { // Handle case where bluetooth service proxy // is already null. Log.e(TAG, "NullPointerException for getBondState() of device (" + getAddress() + ")", npe); } return BOND_NONE; }