仅使用蓝牙选项的共享意图

6

我正在尝试使用我的应用程序通过蓝牙发送文件。 我已将MIME类型更改为一些随机内容,如asdxasd/asdxa 而且文件有一个我需要使用的扩展名,即.sso

当我使用共享意图时,只出现了蓝牙和Gmail选项,但我能否从列表中删除Gmail选项?

非常感谢您! 我正在使用以下代码使用意图进行发送:

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"));
2个回答

12
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"));

1
@DarkLink 很高兴能帮助你 :) - Bishan

2

如果您有设备图像的路径,则使用以下命令:

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"));

这可能是一个老问题。我只想问一下是否有可能直接发送文件而不显示蓝牙配对设备选项? - Paula Kristin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接