0

I want to make a share button to share a photo from my app directly to the users facebook, assuming they have it installed and are logged in. But the tutorial on the facebook api guide only has one that requires the user to log in, which I don't want to have to do.

I know that startActivity(Intent.createChooser(shareIntent, "Share via")); will do what I want but I would rather have a facebook specific button that does exactly what the chooser will do but without the user having to open the chooser and select facebook.

I have tried

    Intent facebookIntent = new Intent(Intent.ACTION_SEND);
    fbIntent.setClassName("com.facebook.katana",packageName);
    facebookIntent.setType("image/jpeg");
    facebookIntent.putExtra(Intent.EXTRA_STREAM, uri);
    startActivity(facebookIntent);

where package name comes from getPackageManager().queryIntentActivities(intent, 0) (There is a bit more code around it but I'd like to keep the code to a minimum)

Is there a way to do this with the facebook api or even without?

Cob50nm
  • 911
  • 2
  • 9
  • 27
  • In order to post a picture, you need to be logged in to Facebook. However, the Facebook API has a single sign on solution where if you are signed in to the Facebook app, it will generate a session token for you and won't prompt you to log in. With an established session you can post directly to Facebook. – Nick Aug 19 '13 at 22:39
  • Is there anyway to get that session token without the user having to sign into facebook from my app? assuming they have facebook installed and are logged in – Cob50nm Aug 20 '13 at 08:14
  • You do not have to log in again with the Facebook API, it uses your account information from the already logged in app to create the Session--single sign on. Check out as there are several steps you will need to complete in order to use this solution. – Nick Aug 20 '13 at 20:28

0 Answers0