我尝试将应用程序中的视频分享到Instagram故事或Feed,但为Feed而不是为故事运行。为什么相同的代码成功地为Feed运行,而不是为故事运行。
我的共享代码:
protected void shareInsta()
{
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse(String.valueOf(dest));
sharingIntent.setType("video/*");
sharingIntent.setPackage("com.instagram.android");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share Video "));
}
答案 0 :(得分:0)
尝试一下可能会对您有所帮助
public static void shareVideo(Activity activity, String sharedImgPath, String pkgName) {
ArrayList<Uri> list = new ArrayList<>();
list.add(FileProvider.getUriForFile(activity, BuildConfig.APPLICATION_ID + ".provider", new File(sharedImgPath.replace("file://", "").trim())));
Intent intentImage = new Intent(Intent.ACTION_SEND);
intentImage.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intentImage.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(activity, BuildConfig.APPLICATION_ID + ".provider", new File(sharedImgPath.replace("file://", "").trim())));
intentImage.setType("video/*");
if (pkgName.length() > 0) {
intentImage.setPackage(pkgName);
}
activity.startActivity(intentImage);
}
如何拨打电话
shareVideo(context,"file://storage/abc/video.mp4","com.instagram.android");