Skip to content Skip to sidebar Skip to footer

How To Open Facebook App On User Timeline?

I'm trying to open a facebook app, from my app, but i need it to go to specific user's timeline. I can open it in the phone browser it works fine, but i can't open it in facebook a

Solution 1:

Just do a little change

"https://www.facebook.com/profile.php?id=" + userId

Try this one.

Also, FYI: https://www.facebook.com/" + userId will work only when you pass username not userId.

Solution 2:

The only code that worked for me was:

publicIntentgetOpenFacebookIntent(String userId) {
        Log.e(TAG, "pid "+ userId);

        String facebookUrl = "https://www.facebook.com/"+userId;
        try {
            getPackageManager().getPackageInfo("com.facebook.katana", 0);

            returnnewIntent(Intent.ACTION_VIEW, Uri.parse("fb://facewebmodal/f?href=" + facebookUrl));

        } catch (Exception e) {
            returnnewIntent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/app_scoped_user_id/" + userId));

        }
    }

Post a Comment for "How To Open Facebook App On User Timeline?"