Pinterest Sharing From Android App using Intent is not working,Can somebody help me on this?
Uri bmpUri = Uri.fromFile(imageFileToShare)
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra("com.pinterest.EXTRA_DESCRIPTION", "Messagessssssssss");
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "Share Image"));
Try this, but you should test if Pinterest is already installed in user's device.
File imageFileToShare = new File(orgimagefilePath);
Uri uri = Uri.fromFile(imageFileToShare);
Intent sharePintrestIntent = new Intent(Intent.ACTION_SEND);
sharePintrestIntent.setPackage("com.pinterest");
sharePintrestIntent.putExtra("com.pinterest.EXTRA_DESCRIPTION", text);
sharePintrestIntent.putExtra(Intent.EXTRA_STREAM, uri);
sharePintrestIntent.setType("image/*");
startActivityForResult(sharePintrestIntent, PINTEREST);
source
Related
I want to share image from my app to Whatsapp but it's giving me the error "sharing failed , please try again" this is my code:
String text = "Look at my awesome picture";
Uri pictureUri = Uri.parse("file://www.punjabidharti.com/wp-content/uploads/2018/05/baap-600x600.jpg");
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, text);
shareIntent.putExtra(Intent.EXTRA_STREAM, pictureUri);
shareIntent.setType("image/*");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "Share images..."));
and I am using image url from my website.
You are passing a http url not a file url. Make your uri like this and it will work
Uri pictureUri = Uri.parse("http://www.punjabidharti.com/wp-content/uploads/2018/05/baap-600x600.jpg");
I want to share video file to Line app from my app.
In android 6.0 and 7.0
I can use following code to share.
Uri uri = Uri.fromFile(fileFull);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("video/mp4");
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(shareIntent, getString(R.string.sharevideoto)));
But the new android 8.0 need use fileprovider
Uri uri = FileProvider.getUriForFile(PlayvideoActivity.this,
BuildConfig.APPLICATION_ID + ".provider",fileFull);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("video/mp4");
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(shareIntent, getString(R.string.sharevideoto)));
But Line app will show error when use fileprovider to share video.
But using fileprovider share picture is work.
for Kotlin
fun onShareVideo(uri: Uri, packageNameOfApp: String) {
val share = Intent(Intent.ACTION_SEND)
share.type = "video/*"
share.putExtra(Intent.EXTRA_STREAM, uri)
share.setPackage(packageNameOfApp) //change packageNameOfApp to jp.naver.line.android
startActivity(Intent.createChooser(share, "Share to"))
}
NOTE
You can use code above for twitter, instagram, gmail...
It worked good for all version.
I need to share url and image on facebook wall using intent. If I'm sharing both, only image is getting shared because in intent setype I'm using "image/*". Below are the code snippet
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/*");
String imagePath = Environment.getExternalStorageDirectory()+"/sample_image.png";
File imageFileToShare = new File(imagePath);
Uri uri = Uri.fromFile(imageFileToShare);
shareIntent.putExtra(Intent.EXTRA_TEXT, "URL goes here");
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(shareIntent);
I need to share both url and image. Can anyone help me to solve this issue?
I receive an error when I press a Button.
InputStream y11 = getResources().openRawResource(R.drawable.step_000);
Bitmap b11 = BitmapFactory.decodeStream(y11);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/png");
intent.setPackage("com.whats app.android");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, b11);
startActivity(Intent.createChooser(intent, "Share with"));
You can try like this;
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/png");
Uri uri = Uri.parse("android.resource://your package name/"+R.drawable.ic_launcher);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.putExtra(Intent.EXTRA_TEXT, "Hello, This is test Sharing");
startActivity(Intent.createChooser(shareIntent, "Send your image"));
Also look into this: Returning an Image to whatsapp
I am using share intent to post the image and text in Social media App. I am using following code
String shareName=advdetails.get(0).getBusinessname();
String description=advdetails.get(0).getDescription();
Uri image = Uri.parse(advdetails.get(0).getBusinesslogo());
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, description);
shareIntent.putExtra(Intent.EXTRA_STREAM, image);
startActivity(Intent.createChooser(shareIntent, shareName));
The above description, image and ShareName are getting from the pojo class.
When I am trying to share these data into Facebook, I am getting the information as "One or more Media items could not be added"
Try this to share image
File filePath = getFileStreamPath("shareimage.jpg");
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, _text);
shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(new File(filePath))); //optional//use this when you want to send an image
shareIntent.setType("image/jpeg");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "send"));