Bluetooth sharing

I am trying to send a file via bluetooth using my application. I already changed the mime type to random, like asdxasd / asdxa And the file has an extension that I need to use, i.e. .sso

When I use the sharing intent, only the bluetooth and gmail option appears, but can I remove the gmail option from the list?

Thanks in advance! I use this code to send it using the intent:

file = new FileSystem(this).saveTemp(); Intent sharingIntent = new Intent(Intent.ACTION_SEND); Uri screenshotUri = Uri.fromFile(file); sharingIntent.setType("test/onlineconfig"); sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri); startActivity(Intent.createChooser(sharingIntent, "Share Config Using")); 
+6
source share
2 answers
 Intent sharingIntent = new Intent(Intent.ACTION_SEND); Uri screenshotUri = Uri.parse(picURI); sharingIntent.setType("image/*"); sharingIntent.setPackage("com.android.bluetooth"); sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri); startActivity(Intent.createChooser(sharingIntent, "Share image")); 
+12
source

if you have a path to the device image, use:

 Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("image/*"); intent.setPackage("com.android.bluetooth"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagepath))); startActivity(Intent.createChooser(intent, "Share image")); 
+2
source

Source: https://habr.com/ru/post/945852/


All Articles