简体   繁体   English

Android:无法使用 Intent 在 Instagram 上分享照片

[英]Android : Not able to share photos on Instagram using Intent

I am not able to share any photo on Instagram feed using Intent in Android.我无法在 Android 中使用 Intent 在 Instagram 提要上分享任何照片。 It opens Instagram and shows "Unable to load Photo" error and comes back to my app.它打开 Instagram 并显示“无法加载照片”错误并返回到我的应用程序。

 Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("image/*");
    share.putExtra(Intent.EXTRA_STREAM, uri);
    share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    startActivity(Intent.createChooser(share, "Share to"));

This same code was working on Instagram version 131.0.0.23.116 but it's not working on the current updated version is 134.0.0.26.121相同的代码适用于 Instagram 版本 131.0.0.23.116,但不适用于当前更新的版本 134.0.0.26.121

I got the same problem.我遇到了同样的问题。 It's cannot be sharing with Instagram Feed, but still working when sharing with Instagram Story and Direct.它不能与 Instagram Feed 共享,但在与 Instagram Story 和 Direct 共享时仍然有效。 -> That probably an issue of Instagram new update version, not Android os. -> 那可能是 Instagram 新更新版本的问题,而不是 Android 操作系统的问题。 I try from android version >= 24(N) and got the same error我从 android 版本 >= 24(N) 开始尝试并得到相同的错误

But when share from Google Photo app to Instagram Feed, still working normally但是当从 Google Photo 应用分享到 Instagram Feed 时,仍然正常工作

It seems that the Instagram app's ability to receive app-internal files via ContentProvider (or FileProvider, a descendent of CP) was broken by a recent update.最近的更新似乎破坏了 Instagram 应用程序通过ContentProvider (或 FileProvider,CP 的后代)接收应用程序内部文件的能力。 A workaround is to write the file to MediaStore first then share the content Uri that points to that image file.解决方法是先将文件写入MediaStore然后共享指向该图像文件的内容 Uri。

Drawback is that the image will be written the the Pictures folder in the MediaStore , but in the meantime it gets sharing to feed working again.缺点是图像将被写入MediaStorePictures文件夹,但同时它会再次共享以供提要工作。

Answer is here, linked to avoid duplication: https://stackoverflow.com/a/60869229/513626答案在这里,链接以避免重复: https : //stackoverflow.com/a/60869229/513626

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM