i want to Share video ,i have link of that and its downloaded in the app when user want to share that video,
now video is not shared on whatsapp i dont now how ,here is my code
which i tried but not worked.
Intent videoshare = new Intent(Intent.ACTION_SEND);
videoshare.setType("*/*");
videoshare.putExtra(Intent.EXTRA_STREAM, Uri.parse(Environment.DIRECTORY_DOWNLOADS+"/"+title));
videoshare.setPackage("com.whatsapp");
startActivity(Intent.createChooser(videoshare, "Share video"));
i finally found the solution is here
public void shareVideoWhatsApp() {
Uri uri = Uri.fromFile(v);
Intent videoshare = new Intent(Intent.ACTION_SEND);
videoshare.setType("*/*");
videoshare.setPackage("com.whatsapp");
videoshare.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
videoshare.putExtra(Intent.EXTRA_STREAM,uri);
startActivity(videoshare);
}
public void shareVideo(String pkgname, String appname) {
String path = null;
try {
path = MediaStore.Images.Media.insertImage(getContentResolver(),
arrImagePath.get(slidePager.getCurrentItem()), "Title", null);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
Uri uri = Uri.parse(path);
Intent share = new Intent(Intent.ACTION_SEND);
share.setPackage(pkgname);
share.putExtra(Intent.EXTRA_STREAM, uri);
share.setType("Video/*");
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(share, "Share image File");
}
shareVideo("com.whatsapp", "Whatsapp");