android - share video on whatsapp from my app -
i want share video ,i have link of , downloaded in app when user want share video,
video not shared on whatsapp dont how ,here code
tried 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"));
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");
wiki
Comments
Post a Comment