How to measure distance between two iphone devices using bluetooth? [closed]

Using bluetooth for localization is a very well known research field (ref.). The short answer is: you can’t. Signal strength isn’t a good indicator of distance between two connected bluetooth devices, because it is too much subject to environment condition (is there a person between the devices? How is the owner holding his/her device? Is … Read more

Linux command line howto accept pairing for bluetooth device without pin

Entering a PIN is actually an outdated method of pairing, now called Legacy Pairing. Secure Simple Pairing Mode is available in Bluetooth v2.1 and later, which comprises most modern Bluetooth devices. SSPMode authentication is handled by the Bluetooth protocol stack and thus works without user interaction. Here is how one might go about connecting to … Read more

Android sample bluetooth code to send a simple string via bluetooth

private OutputStream outputStream; private InputStream inStream; private void init() throws IOException { BluetoothAdapter blueAdapter = BluetoothAdapter.getDefaultAdapter(); if (blueAdapter != null) { if (blueAdapter.isEnabled()) { Set<BluetoothDevice> bondedDevices = blueAdapter.getBondedDevices(); if(bondedDevices.size() > 0) { Object[] devices = (Object []) bondedDevices.toArray(); BluetoothDevice device = (BluetoothDevice) devices[position]; ParcelUuid[] uuids = device.getUuids(); BluetoothSocket socket = device.createRfcommSocketToServiceRecord(uuids[0].getUuid()); socket.connect(); outputStream = socket.getOutputStream(); … Read more

How to programmatically force bluetooth low energy service discovery on Android without using cache

I just had the same problem. If you see the source code of BluetoothGatt.java you can see that there is a method called refresh() /** * Clears the internal cache and forces a refresh of the services from the * remote device. * @hide */ public boolean refresh() { if (DBG) Log.d(TAG, “refresh() – device: … Read more

How to unpair or delete paired bluetooth device programmatically on android?

This code works for me. private void pairDevice(BluetoothDevice device) { try { if (D) Log.d(TAG, “Start Pairing…”); waitingForBonding = true; Method m = device.getClass() .getMethod(“createBond”, (Class[]) null); m.invoke(device, (Object[]) null); if (D) Log.d(TAG, “Pairing finished.”); } catch (Exception e) { Log.e(TAG, e.getMessage()); } } private void unpairDevice(BluetoothDevice device) { try { Method m = device.getClass() … Read more

Bluetooth and WIFI Printing for Android

Starting with Android 4.4 you can print documents from a device to a hardware printer via wifi. Android apps can now print any type of content over Wi-Fi or cloud-hosted services such as Google Cloud Print. In print-enabled apps, users can discover available printers, change paper sizes, choose specific pages to print, and print almost … Read more