1

Why I can't set a text when I'm sharing on facebook? I have this code:

Intent shareIntent = new Intent(Intent.ACTION_SEND);

shareIntent.setType("text/plain");

String str = "My Text\n" + "http://play.google.com/store/apps/details?id=com.google.android.apps.maps";

shareIntent.putExtra(Intent.EXTRA_TEXT, str);

        List<ResolveInfo> matches = getPackageManager().queryIntentActivities(shareIntent, 0);
        for (ResolveInfo info : matches) {
            if (info.activityInfo.packageName.toLowerCase().contains("com.facebook.katana")) {
                shareIntent.setPackage(info.activityInfo.packageName);
                startActivity(shareIntent);
                break;
            } 
        }

And it works, but only the link appears. Anyone Knows what is wrong? (I don't want to use Facebook SDK.)

Thanks

EmilyR
  • 179
  • 1
  • 11
  • See this: http://stackoverflow.com/questions/7545254/android-and-facebook-share-intent – iazaran Oct 09 '16 at 22:30
  • @Giliapps I had stumbled on this answer before, but how it was of 2011 I thought that maybe already had been fixed. Bad facebook! >:( Thanks – EmilyR Oct 10 '16 at 12:53

2 Answers2

0

Bad facebook! :-(

This is impossible, Because of you don't want use Facebook SDK.

You have to use the actual official separate Facebook Android SDK in your project to get the full sharing functionality. Which is extra work. Change your decision, then see this: https://developers.facebook.com/docs/sharing/android

iazaran
  • 196
  • 1
  • 6
  • 17
0
    ShareDialog shareDialog;
    FacebookSdk.sdkInitialize(getApplicationContext());
shareDialog = new ShareDialog(UserProfileActivity.this);
ShareLinkContent content1 = new ShareLinkContent.Builder()
                            .setContentUrl(Uri.parse("https://Your url"))
                            .setContentTitle("name of content")
                            .setContentDescription("description")
                            .setImageUrl(Uri.parse("img url"))
                            .build();
                            shareDialog.show(content1);
Rajesh Satvara
  • 3,842
  • 2
  • 30
  • 50