Android: action_send intent is not showing facebook - android

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.

Related

How to combine ACTION_SEND and ACTION_VIEW intent types?

I would like to share a URI from my app, and have the app chooser dialog show options for ACTION_SEND apps (like SMS and copy to clipboard) as well as ACTION_VIEW apps (like Chrome). So far, I can only seem to get one set of apps to show at a time. Is there a way to combine intent actions?
Here is what plain ACTION_SEND intent looks like:
Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_TEXT, "www.example.com");
context.startActivity(Intent.createChooser(i, "Share"));
This results in the normal chooser for apps that send information. But no open in browser options.
Here is what ACTION_VIEW intent looks like:
Intent i = new Intent();
i.setAction(Intent.ACTION_VIEW);
i.putData(Uri.parse("www.example.com"))
context.startActivity(Intent.createChooser(i, "Share"));
This results in the normal chooser for opening the link in the browser. But no options for info sending apps.
Is there a way to "combine" these two behaviors so both sets of options show up in the chooser dialog?
I have also tried to add categories to the intent, but no luck.
EDIT: I stumbled across this question where the OP has the same issue. However, I would like a solution that does not involve creating a bunch of custom activities for each app I'd like to show in the chooser.
I know this is late, but have a different solution:
Create intents for send and view. Create a chooser intent for one of them and pass the other intent as Intent.EXTRA_INITIAL_INTENTS. Like this:
// Share
val sendIntent = Intent(Intent.ACTION_SEND)
sendIntent.setDataAndType(uri, MIME_PDF_TYPE)
sendIntent.putExtra(Intent.EXTRA_TEXT, "TEST")
sendIntent.putExtra(Intent.EXTRA_STREA, uri)
// Open
val openIntent = Intent(Intent.ACTION_VIEW)
openIntent.setDataAndType(uri, MIME_PDF_TYPE)
openIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
val chooserIntent = Intent.createChooser(sendIntent,activity.getString(R.string.sharing_title))
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, arrayOf(openIntent))
activity.startActivity(chooserIntent)
i have kotlin snippet and i'm sharing with you. You can use sharecompact builder.
ShareCompat.IntentBuilder.from(requireActivity())
.setType("text/plain")
.setSubject(getString(R.string.app_name))
.setChooserTitle("Share via")
.setText(your text)
.startChooser()

How to make app picker for sharing text permanent in Android?

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.

Share Intent Not Working With Facebook Messenger

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")

Facebook share doesn't work correctly

I am trying to share a text containing a link via facebook.
My code work perfectly with the facebook messenger application. But not via Facebook app.
In Facebook app i am getting a sharing view with an empty edittext. I Don't want to integrate facebook api and give sharing authorisation. I don't want to do that. I think it can be done only via extras and intent.
My sharing code:
private void ShareWebView(){
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, mTitle);
startActivity(Intent.createChooser(intent, "Share with"));
}
You cannot. See Android and Facebook share intent
And especially this link provided in one of the comment : http://developers.facebook.com/bugs/332619626816423
Walkaround: If you do not want to implement it using android SDK
and you want to use
private void ShareWebView(){
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, mTitle); // MUST contain 1 url
startActivity(Intent.createChooser(intent, "Share with"));
}
make sure that mTitle contains one LINK.
Why to do that: Although the fact that facebook doesn't work properly it grubs the first url or look like url from the mTitle and post-it as share url. It also automatically catch a subtitle and a photo from that url so the post/share is quite acceptable most of the time avoiding long code implementations!

How to add Facebook Share button in Android Application

I am beginner in android.I want to add FacebookShare button in my android application.I create the app in 2.2 .please help me
I use this code
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,getResources().getStri‌​ng(R.string.title_activity_android_face_book_share));
emailIntent.putExtra(android‌​.content.Intent.EXTRA_TEXT,getResources().getString(R.string.title_activity_android_face_book_share));
startActivity(emailIntent);
I Use the following link also Best way for social sharing in Android
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, "URLyouWantToShare");
startActivity(Intent.createChooser(shareIntent, "Share..."));
Use the ACTION_SEND Intent, add the URL you want to share. User will be given a selection of apps to accept the share intent such as facebook etc.

Categories

Resources