【问题标题】:Share Intent with Bluetooth Option Only仅通过蓝牙选项共享意图
【发布时间】:2013-05-21 06:44:01
【问题描述】:

我正在尝试使用我的应用通过蓝牙发送文件。 我已经将 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"));

【问题讨论】:

    标签: android android-intent bluetooth share


    【解决方案1】:
    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"));
    

    【讨论】:

    • 非常感谢伙计!这正是我一直在寻找的^^
    • @DarkLink 很高兴为您提供帮助:)
    【解决方案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"));
    

    【讨论】:

    • 这可能是一个老问题。我只是想问一下是否可以不显示蓝牙配对设备选项直接发送文件?
    猜你喜欢
    • 2012-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多