0

I want to send a file through my code. I know the file path, and that I want to do it through bluetooth. When I call this intent, it displays a popup asking if I want to send the file through bluetooth, gmail, facebook, etc.

   Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain");    
   i.putExtra(Intent.EXTRA_STREAM, Uri.parse(path)); 
   startActivity(Intent.createChooser(i, "Send File"));

Is there a way to skip this popup step and specify that I want to do it through bluetooth all the time?

Also if I knew the address of the bluetooth device I want to send it to, is there a way to specify that as well through the code in the intent?

user1487000
  • 1,161
  • 3
  • 12
  • 17

1 Answers1

2

Maybe you can have a try for this code, it works for me! it would only choose Bluetooth as you want

intent.setPackage("com.android.bluetooth");
dddog
  • 51
  • 1
  • 11