I believe that I have a (at least partial) solution, which then should allow interception of files through OPP and added custom code. The first step is to go to settings> apps> running> Bluetooth Share and killBluetoothOppService
BluetoothAdapter ( ), . OPP . SO OPP, OPP "OK", .. os.writeByte(ObexSession.OBEX_SUCCESS | ObexSession.OBEX_FINAL_BIT);
public class BluetoothAdapterProxy
{
public static final int CHANNEL_OPP = 12;
final BluetoothAdapter target;
static final Class<?> targetClass = BluetoothAdapter.class;
Method listenOn;
public BluetoothAdapterProxy(BluetoothAdapter target)
{
this.target = target;
Class<?>[] args = new Class[] { int.class };
try
{
this.listenOn = targetClass.getDeclaredMethod(
"listenUsingRfcommOn", args);
}
catch (NoSuchMethodException e)
{
e.printStackTrace();
}
}
public BluetoothServerSocket listenUsingRfcommOn(int channel)
{
try
{
return (BluetoothServerSocket) (listenOn.invoke(target,
new Object[] { channel }));
}
catch (Exception e)
{
throw new RuntimeException(ex);
}
}
}
:
serverSocket = new BluetoothAdapterProxy(BluetoothAdapter.getDefaultAdapter())
.listenUsingRfcommOn(BluetoothAdapterProxy.CHANNEL_OPP);
Thread ( ), socket = serverSocket.accept();