【问题标题】:Send image as document to whatsapp programmatically以编程方式将图像作为文档发送到whatsapp
【发布时间】:2020-07-11 20:10:39
【问题描述】:

问题是,如何在不压缩和质量损失的情况下将大图像(例如 720 * 8549)发送到 WhatsApp。 可以这样做吗?

以下是发送我使用的图像的代码:

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
File photoFile = new File(imageFile.getParent(), imageFile.getName());
Uri photoURI = FileProvider.getUriForFile(getBaseContext(), getApplicationContext().getPackageName(), 
photoFile);
shareIntent.putExtra(Intent.EXTRA_STREAM,photoURI);
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, getBaseContext().getString(R.string.photo_share)));

所以我发送了一个压缩且不可读的图像。 也许有人遇到过类似的情况。

祝大家好运!

【问题讨论】:

    标签: java android send whatsapp


    【解决方案1】:

    这是不可能的,因为 WhatsApp 总是会缩小尺寸。 Google Photos 也尝试过,但如果您在通过 Google Photos 发送时选择 Original,最终尺寸仍会缩小。

    您为什么不使用 Telegram 之类的其他应用?你有更多的选择。 最简单的方法是共享原始链接,例如谷歌照片或 Dropbox。

    【讨论】:

    • 感谢您的回答!
    • 我有一个应用程序(例如画廊),我想在其中实现将图像(包括长图像)传输到社交应用程序而不进入它们。
    猜你喜欢
    • 1970-01-01
    • 2019-01-31
    • 1970-01-01
    • 1970-01-01
    • 2010-12-02
    • 1970-01-01
    • 2018-09-14
    • 2013-10-05
    • 1970-01-01
    相关资源
    最近更新 更多