Android examples for android.bluetooth:Bluetooth
get Rfcomm Socket By Reflection
import java.lang.reflect.Method; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; public class Main { private static synchronized BluetoothSocket getRfcommSocketByReflection(BluetoothDevice device) throws Exception { if (device == null) return null; Method m = device.getClass().getMethod("createRfcommSocket", new Class[] { int.class }); return (BluetoothSocket) m.invoke(device, 1); }// w ww.ja v a2 s .c o m }