Open a facebook page from android app?

前端 未结 4 562
闹比i
闹比i 2020-12-30 16:20

How can I start an intent to open a Facebook application on a phone and navigate to the prefered page in Facebook?

I tried:

Intent intent = new Inten         


        
4条回答
  •  余生分开走
    2020-12-30 16:56

    I had the exactly same problem, sent the user id but for some reason, my profile always opened instead of the friend's profile.

    The problem is that if you pass the String of the Long object that represents the Facebook UID, or even a long primitive type, the intent won't be able to read it later. You need to pass a real Long.

    So the complete code is:

        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setClassName("com.facebook.katana", "com.facebook.katana.ProfileTabHostActivity");
        Long uid = new Long("123456789");
        intent.putExtra("extra_user_id", uid);
        startActivity(intent);
    

    Ok enjoy and hope this helps :-)

    Maxim

提交回复
热议问题