1

Ok, I'm losing too much hair on this.. Enough!

In my app I have a button that will call Facebook app to update my status. I don't want to do it in my app, I want to do it in Facebook app! I believe that the SDK is not needed for this, is it?

So I found that the way is using an Intent, like I'm doing to send an SMS, or send by Gmail.

public static void viaSMS(Activity activity, String subject, String text) {
        Intent smsIntent = new Intent(Intent.ACTION_VIEW);

        smsIntent.setType("vnd.android-dir/mms-sms");
        smsIntent.putExtra("sms_body",text);

        try {
            activity.startActivity(smsIntent);
        } catch (ActivityNotFoundException ex) {
            // handle error
        }
    }

public static void viaGmail(Activity activity, String subject, String text) {
        Intent gmailIntent = new Intent(Intent.ACTION_VIEW);

        gmailIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail");
        gmailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
        gmailIntent.putExtra(android.content.Intent.EXTRA_TEXT, text);

        try {
            activity.startActivity(gmailIntent);
        } catch (ActivityNotFoundException ex) {
            // handle error
        }
    }

However, I'm not managing to do it with Facebook. I'm not finding the right classname and the extras..

I've already launched successfully the Facebook app, but I want to go directly to the 'Update Status Form'..

public static void viaFacebook(Activity activity, String subject, String text) {
        Intent facebookIntent = new Intent(Intent.CATEGORY_LAUNCHER);

        facebookIntent.setClassName("com.facebook.katana", "com.facebook.katana.LoginActivity");

        try {
            activity.startActivity(facebookIntent);
        } catch (ActivityNotFoundException ex) {
            // handle error
        }
    }
Oliveira
  • 1,281
  • 1
  • 11
  • 19

0 Answers0