This is a small feature that you can use.
public void bluetoothFunctionality() { String path = Environment.getExternalStorageDirectory() + "/" + Config.FILENAME; File file = new File(path); Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); startActivity(intent); }
This method sends the file to another device using the default functionality of the Bluetooth device. Before you do this, you must first connect the device, this is a limitation. to send different types of files you just need to change the MIME type in the set type method.
In your manifest file, you must add two permissions, for example
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH" />
Abhinav singh maurya
source share