title: Android : Get All Contact From Remote Device via Bluetooth Programmatically
body: <p>How to Connect Bluetooth Device and Get Contact from Remote Device. and also Copy in My Phonebook.</p>
  
  <pre><code> private final BroadcastReceiver mPairReceiver = new BroadcastReceiver() {
      public void onReceive(Context context, Intent intent) {
          String action = intent.getAction();
  
          if (BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)) {
              final int state = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.ERROR);
              final int prevState = intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE, BluetoothDevice.ERROR);
  
              if (state == BluetoothDevice.BOND_BONDED &amp;&amp; prevState == BluetoothDevice.BOND_BONDING) {
                  showToast("Paired");
                  BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                  mBluetoothDevice = mBluetoothAdapter.getRemoteDevice(device.getAddress());
                  final TelephonyManager tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
  
              } else if (state == BluetoothDevice.BOND_NONE &amp;&amp; prevState == BluetoothDevice.BOND_BONDED) {
                  showToast("Unpaired");
              }
  
              mAdapter.notifyDataSetChanged();
          }
      }
  };
  </code></pre>