Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

share image does not work in viber and facebook

I use the code below for sharing images but unfortunately it works only for Line, not for Facebook and Viber

Code:

 Intent share = new Intent(android.content.Intent.ACTION_SEND);
 share.setType("image/png");
 share.putExtra(Intent.EXTRA_STREAM, Uri.parse(G.DIR_APP + "/sample_image.png"));
 startActivity(Intent.createChooser(share, "Share image"));
like image 606
hosseinAmini Avatar asked May 25 '14 13:05

hosseinAmini


1 Answers

Share directly to Facebook and Viber...

Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("image/png");
share.setPackage("com.facebook.katana"); 
//for viber package is "com.viber.voip".
share.putExtra(Intent.EXTRA_STREAM, ImageUri);
startActivity(p_intent.createChooser(share, "Share With"));
like image 173
chiragkyada Avatar answered Oct 16 '22 08:10

chiragkyada