提问人:juliangorge 提问时间:11/16/2023 最后编辑:juliangorge 更新时间:11/16/2023 访问量:32
上传 SDK 33 后 Whatsapp 的 Pdf 文件分享按钮停止工作
Whatsapp's share button of Pdf files stopped working after SDK 33 uploading
问:
我拿了一个有人构建的 android 应用程序项目,我的主要任务是更新 SDK,因为用户无法在他们的设备中共享我的 pdf 文件。 然后,我将其上传到:
compileSdkVersion 33
minSdkVersion 23
targetSdkVersion 33
我也上传了清单文件:
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
这是我的一段共享按钮代码:
String directory_path = ctx.getExternalFilesDir("") + "/orders/";
File file = new File(directory_path);
String targetPdf = directory_path + "file.pdf";
File filePath = new File(targetPdf);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("application/pdf");
Uri uri = Uri.fromFile(filePath);
share.setAction(Intent.ACTION_SEND);
share.putExtra(Intent.EXTRA_STREAM, uri);
ctx.startActivity(Intent.createChooser(share, "Compartiendo archivo"));
文件路径内容: System.out: /storage/emulated/0/Android/data/ar.com.juliangorge.orders/files/orders/file.pdf
我报告了任何错误,但是当我触摸“共享”按钮并选择正确的聊天时,Whatsapp说:
“不支持文件格式”。
我错在哪里?因为这个共享按钮以前工作过。
答: 暂无答案
评论
filePath