I am send an Intent with the action Intent.ACTION_SEND. This works fine and the user can pick what application to share with and so on.
The issue is when they pick Facebook Messenger to share. All I get is a white, modal screen with "Send to" in the top left and a search icon in the top right.
Here is the code that launches the intent.
Intent appIntent = new Intent(Intent.ACTION_SEND);
appIntent.setType("text/plain");
appIntent.putExtra(Intent.EXTRA_TEXT,"Check out this app. \nhttp://www.boxshark.co.uk");
appIntent.putExtra(Intent.EXTRA_SUBJECT,"Get the Boxshark app");
startActivity(Intent.createChooser(appIntent,"Share"));
I get that Facebook don't allow pre filled text when you use the share intent so my "Check out this app" text is removed. I don't understand however why the Facebook Messenger app is not doing anything however.
Any ideas anyone? Can you see anything wrong with my intent?
PackageManager pm=getPackageManager();
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("image/jpeg");
Uri uri = Uri.parse("android.resource://1/"+2);
i.putExtra(Intent.EXTRA_STREAM, uri);
PackageInfo info=pm.getPackageInfo("com.facebook.orca", PackageManager.GET_META_DATA);
i.setPackage("com.facebook.orca");
startActivity(Intent.createChooser(i, "Share with"));
1.your package name display in 1st line of your file
2.your image int value from srting which want to share
"com.facebook.orca" is facebook massanger package
Its work for me,hope your also
put only link, do not add text with link.
appIntent.putExtra(Intent.EXTRA_TEXT,"http://www.boxshark.co.uk")
Related
I'm trying to make refer and earn activity in my appSo I want to permanently display a few apps like whatsapp, etc for the user to click on them and share directly.I'm using Intent to share the referral code but it pops up the apps list when the user clicks share.The code I'm using is,
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "This is a message");
intent.setType("text/plain");
startActivity(Intent.createChooser(intent, "Share via"));
How can I make the app chooser permanent for a few apps?
The app chooser is not intended to be displayed permanently. Therefore you will have to create simple buttons or icons and create an intent that refers to the desired app directly, by setting the package of the intent.
E.g. to share sth with WhatsApp use sth like this:
Intent sendIntent = new Intent();
// here comes the magic
sendIntent.setPackage("com.whatsapp");
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);
Depending on the type of content you want to share and the apps you want to share with, it makes sense to reuse the code to create the intent and just set the respective package and eventually some additional parameters.
You will need package name of app and a Intent.
change ACTION_VIEW to ACTION_SENDTO
set the Uri as you did set the
package to whatsapp
Intent i = new Intent(Intent.ACTION_SENDTO,
Uri.parse("content://com.android.contacts/data/" + c.getString(0)));
i.setType("text/plain");
i.setPackage("com.whatsapp"); // so that only Whatsapp reacts and not the chooser
i.putExtra(Intent.EXTRA_SUBJECT, "Subject");
i.putExtra(Intent.EXTRA_TEXT, "I'm the body.");
startActivity(i);
You can refer this link for More:
Send text to specific contact (whatsapp)
Sending message through WhatsApp
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("*/*");
intent.setPackage("com.whatsapp");
intent.putExtra(Intent.EXTRA_TEXT, "your text content");
startActivity(intent)
I am facing same problem for share tamil font content in Whatsapp. I found the solution, this setType("*/*") share full content.
My question is simple, i want to make an intent to instagram app from my app, but i want to show the timeline (just like we are open the instagram app manually), how can i do this?
This method is working to show an user profile, but i want to show the timeline.
private void createInstagramIntent() {
//Creamos intent de instagram y lanzamos la activity
Uri uri = Uri.parse("http://instagram.com/_u/javierjsanchezg");
Intent share = new Intent(Intent.ACTION_VIEW, uri);
share.setPackage("com.instagram.android");
startActivity(share);
}
Instagram is mainly a Photo Sharing App and you need to specify the content type. Check the code below. It will open the Instagram App Home Screen of the App is installed in the device and says no app can perform this action if not installed.
Intent is just a way to connect with other apps and it has minimized
control over the other App.
Uri uri = Uri.parse("http://www.google.com");
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("*/*");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Hi Android Share intent");
sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
sharingIntent.setPackage("com.instagram.android");
startActivity(Intent.createChooser(sharingIntent, "Choose"));
Happy Coding..!!
You can simplify your code to :
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")));
Now as per the user's timeline it depends if it is private or public in order to view it. Hope it helps.
Trying to test the share function of the app, which is in the app it calls createChooser() to open the "sharing" chooser form.
startActivity(Intent.createChooser(sharingIntent, "Share something"));
Question is after the "sharing" chooser form is up how to simulate the clicking on some listed apps item, lets say there is app has description "AppName". Tried following it does not work, the chooser form stays there until the test timeout.
tried:
onView(withContentDescription("AppName"))
.perform(click());
and:
onView(withText("AppName"))
.perform(click());
Below is the example to share something in whatsapp:
Intent waIntent = new Intent(Intent.ACTION_SEND);
waIntent.setType("text/plain");
waIntent.setPackage("com.whatsapp");//package name of whatsapp
waIntent.putExtra(Intent.EXTRA_TEXT, "Share Something");//text to share
startActivity(Intent.createChooser(waIntent,"Share via..."));
I hope this might help you.
I put a button to share my Android app on Facebook, so I wrote the following code
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
// add the app link
intent.putExtra(Intent.EXTRA_TEXT, "http://play.google.com/store/apps/details? id=com.phonelight.realparrot");
startActivity(Intent.createChooser(intent, "Share with Facebook"));
After sharing, I opened my Facebook account and saw the following:
As you can see, It should be an image in the right square. I am wondering how can I put that image, I am thinking to put my icon app
Like if you share a youtube link, the image will be the first shot of the movie.
Change intent.setType("text/plain");
to intent.setType("image/*");
then add intent.putExtra(Intent.EXTRA_STREAM, myImageContentUri);
I recently implemented the action-send intent to share a plain text. Facebook is installed and updated on my phone but only "Googlemail" and "Textmessage" are shown as options for sharing my text.
A short code snippet:
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, item.getTitle());
intent.putExtra(
android.content.Intent.EXTRA_TEXT,
(item.getDescription());
startActivity(Intent.createChooser(intent, "Send..."));
Any suggestions what's wrong with my app?
Normally I would think that I dont have to implement the whole facebook sdk for my simple purpose?!
Thanks in advance
The MIME type to use is text/plain, not plain/text.