Question

I would like to transfer files (using OBEX / OPP / FTP profile over Bluetooth) between two instances of my mobile app which is running on two unpaired Android devices (which are not rooted). Is this possible?

If not, can I pair the devices without user interaction and unpair them once the transfer is finished? I am guessing not:

 public static final String BLUETOOTH  (Added in API level 1)

   Allows applications to connect to paired bluetooth devices. 

 public static final String BLUETOOTH_ADMIN  (Added in API level 1)

   Allows applications to discover and pair bluetooth devices.

 public static final String BLUETOOTH_PRIVILEGED  (Added in API level 19)

   Allows applications to pair bluetooth devices without user interaction. **This 
   is not available to third party applications**. 

Still, I have also found this explanation so would love to be corrected:

BLUETOOTH is for connecting to devices that have already been paired in the 
bluetooth settings.  BLUETOOTH_ADMIN allows you to connect to any 
device -- paired or not.
Était-ce utile?

La solution

Looks like pairing without user interaction was possible at some point, judging by this:

How can I avoid or dismiss Android's Bluetooth pairing notification when I am doing programmatic pairing?

However, the notification message asking for a PIN still appeared for the OP it seems, and they could not solve that.

The basic approach that the OP described seems to have been working on 2.3 but I'd guess (and hope, as it reeks of a giant security risk) it does not anymore.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top