Android 发送Whatsapp邀请,就像其他应用程序在pie设备中不工作一样
我的代码在没有图像发送的情况下运行良好,但当我发送带有图像的数据时,它会显示错误。若你们给了我一些url,那个么之前已经发布了答案,所以请确保答案是正确的,因为我在stackoverflow上尝试了很多答案 这是我的密码Android 发送Whatsapp邀请,就像其他应用程序在pie设备中不工作一样,android,android-intent,share,invite,Android,Android Intent,Share,Invite,我的代码在没有图像发送的情况下运行良好,但当我发送带有图像的数据时,它会显示错误。若你们给了我一些url,那个么之前已经发布了答案,所以请确保答案是正确的,因为我在stackoverflow上尝试了很多答案 这是我的密码 Uri contentUri = Uri.parse("android.resource://" + BuildConfig.APPLICATION_ID + "/drawable/" + "ic_launcher"); if (content
Uri contentUri = Uri.parse("android.resource://" + BuildConfig.APPLICATION_ID + "/drawable/" + "ic_launcher");
if (contentUri != null) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
// shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // temp permission for receiving app to read this file
shareIntent.setType("text/plain");
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, "MY messgae");
shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
try {
startActivity(Intent.createChooser(shareIntent, "Share via"));
} catch (ActivityNotFoundException e) {
Toast.makeText(getContext(), "No App Available", Toast.LENGTH_SHORT).show();
}
}
它显示的错误是发送数据失败,请稍后重试
我无法获取我的错误。
android.resource
驻留在APK中,无法读取/写入。。您需要提供可读取的内部/外部存储路径。在坚果壳中,您需要先将此图像保存在存储器中,然后使用此url进行共享。此图像可能重复