I am now planning to share some text and link to SNS app in the phone.
And the code I use is below:
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, "the word i like to say");
shareIntent.setType("text/plain");
this.startActivity(Intent.createChooser(shareIntent, "share with below apps"));
return shareIntent;
there are so many options but unfortunately there is no Wechat Moments in it. Of course I can use shareSDK to achieve that, but the latter one has no Facebook/LinkedIn/Google+ in it. And there are too many 3rd libs included which I don't like. What is more, to show share options in two seperate menus is quite wired.
So, is there a way that I can add the option "Wechat moments" into the previous implementation(just like the image below) ? That will be quite helpful.
Wechat only accepts image.
Below will works.
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(File obj));
shareIntent.setType("image/jpeg");
this.startActivity(Intent.createChooser(shareIntent, "share with below apps"));
return shareIntent;
Related
I am very new to this topic how to share my app along with image and text,play store link,my images and text getting from server and image should be not visible after sharing content ,please any one help me how to share this content to other apps like whats app,twitter and more ....
here below my code
File filePath = getFileStreamPath("news_image");
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(filePath));
shareIntent.setType("image/png");
shareIntent.putExtra(Intent.EXTRA_TEXT,
"Here is my IMAGE");
startActivity(Intent.createChooser(shareIntent, "Share IMAGE Using..."))
You should follow the advice from android documentation.
Snippet from the page:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.example.android"));
startActivity(intent);
I'd like to share different information depending on the application selected by the user. For example, I'd like to send shorter text to Twitter than I do Gmail (otherwise, I go over in characters). Is there anyway to achieve this? Bonus question, is it possible to make hyperlinks via sharing via Gmail or SMS. For example, "Download here" where 'here' is a link instead of "Download by clicking the link below: http://..."
Current code:
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, getTextToShare(data));
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, data.getTitle());
startActivity(Intent.createChooser(shareIntent, "Share this story"));
To find the selected share target this could be interesting for you: Branching the Android Share Intent extras depending on which method they choose to share
By using below code may helps you:
String shareText="Download <a href='[download link]'>here</a>";
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, Html.toHtml(shareText));
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, data.getTitle());
startActivity(Intent.createChooser(shareIntent, "Share this story"));
Share Url Links and Texts into Social Networks (Facebook,Twitter and linkedin)
I need to share text and one image from my application via a share intent. I read this article. I thought it would be easy to create share intent. But it is not so easy, because there is a problem with sharing via Facebook.
I need to share some text and one image, which is stored in device. My first attempt looked like this:
The first try
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/img.jpg")));
shareIntent.putExtra(Intent.EXTRA_TEXT, "My custom text...");
shareIntent.setType("image/jpg");
startActivity(Intent.createChooser(shareIntent, getString(R.string.label_share)));
I tried this code and in applications like Gmail, Google+, Google Keep, etc, everything works fine. But Facebook did not work fine.
There is no my text ("My custom text...") in this screenshot. So I have tried something else.
The second try
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/img.jpg")));
shareIntent.putExtra(Intent.EXTRA_TEXT, "My custom text...");
shareIntent.setType("text/plain");
startActivity(Intent.createChooser(shareIntent, getString(R.string.label_share)));
And the result of this is here:
There is no text and also no image in this screenshot.
I also tried to change type to image/* and */*, but it did not help. I do not know what is wrong. I just need to share some text and image via Facebook. The first try works well for other applications, but for Facebook not.
Can someone help me, please?
Your first attempt is OK, Facebook does not allow sharing text this way, they say "Pre-filling these fields erodes the authenticity of the user voice."
The question is (might be a repeated one), but I could not find a proper answer to it, so asking here again.
In my application, I need to share both an image and a text file using a single intent.
I read a few answers, like:
ACTION_SEND sending both an Image and Text in the same Intent,
Send Image and Text both using ACTION_SEND or ACTION_SEND_MULTIPLE
and also Problems sharing combined text and image with SHARE INTENT
and tried to implement the given solutions in my application, but none of them worked for me.
The code I've implemented so far is as below :
Intent share = new Intent(Intent.ACTION_SEND);
share.putExtra(Intent.EXTRA_SUBJECT, "I found movie "+movieTitle+" on Movies Tracker!");
share.putExtra(Intent.EXTRA_TEXT, "my text");
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
share.setType("image/*");
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(share, "Share via"));
So now my question is: is there any way to share both an image and a text file with single intent?
If it's possible, then please help regarding this issue.
Thanks in advance.
try this one
private void initShareIntent(String type,String _text){
File filePath = getFileStreamPath("<span class="skimlinks-unlinked">shareimage.jpg</span>"); //optional //internal storage
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"));
}
I want to send a predifined google+ message via android, but I\m not sure I found the right URL for that. I found https://plus.google.com/app/plus/mp/430/#~loop:view=compose , but it's not setting my text. Is there actually another official app URL that could allow that? Twitter has the one bellow. 10x
Intent i = new Intent();
i.putExtra(Intent.EXTRA_TEXT, msg);
i.setAction(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://mobile.twitter.com/compose/tweet"));
ctx.startActivity(i);
You can share text and images on Google+ with the ACTION_SEND intent.
Example:
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, "Hello World!");
shareIntent.setType("text/plain");
startActivity(shareIntent);
If you would like to target the Google+ app directly, you can call setPackage on the shareIntent before calling startActivity.
shareIntent.setPackage("com.google.android.apps.plus");