Java – Android Bluetooth connects another Bluetooth device

Android Bluetooth connects another Bluetooth device… here is a solution to the problem.

Android Bluetooth connects another Bluetooth device

I’m doing a Bluetooth-based app and I want to connect other devices like Nokia devices and printers.

I cited the Android Bluetooth documentation http://developer.android.com/guide/topics/connectivity/bluetooth.html. It demonstrates all the basic Bluetooth API functionality, and I did all of those things

Scanning for other Bluetooth devices
Querying the local Bluetooth adapter for paired Bluetooth devices
Establishing RFCOMM channels/sockets
Connecting to a remote device
Transfering data over Bluetooth

I get references from BluetoothChat and android examples.

BluetoothChat This application send data to another android device but for that this application must be installed in both the devices.

Like this< a href="https://stackoverflow.com/questions/6227498/how-to-send-file-from-android-device-to-other-device-through-bluetooth-by-code" rel="noreferrer noopener." nofollow">How to send file from Android device to other device through Bluetooth by code

What I want is

  1. I want to send files from one device to another through my app, even another device that is not running our app will work. That is, the receiver device is also able to receive files using the default Bluetooth.

Is this feasible in Android?

Solution

I don’t think it’s possible.

In fact, when you create a Bluetooth socket, you have to use createRfcommSocketToServiceRecord (UUID).

This function requires a UUID, which is a string shared between applications on both devices so that a connection can be established.

Without a Bluetooth socket listening on another device, with the exact same UUID, you won’t be able to share data.

Related Problems and Solutions