Is it impossible now to open Facebook Messenger chathead of friends from my app?
Asked Answered
S

1

0

I'm retrieving user's Facebook id using AccessToken.getCurrentAccessToken.getUserId() and saving it in FirebaseDatabase.

Then I'm retrieving it and populating several CardViews using the data. Each card gets an ID and there's a button on card which when pressed should open the Facebook Messenger chathead associated with that ID.

I tried opening the chathead using this code:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb-messenger://user/"+fbID));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);

Though it is opening the chathead but not of the user whose ID was associated with that card. It opens the chathead for some anonymous Facebook User.

I searched internet and find out that now Facebook allows to have a different id which is called app scoped user id. When I tried to get the id from https://findmyfbid.com, I got the original ID.

The problem is that with the app scoped user id, we can't open the specific chathead anymore but with the ID fetched from findmyfbid.com, the chathead for that specific user gets opened.

So, is it completely impossible now to open chathead of various users or is there any other way to do this.

Please let me know if there is another way to send message to that user using his/her Facebook ID.

Scruple answered 20/10, 2017 at 2:21 Comment(2)
Hi Hammad Nasir, were you able to figure this out ? I too am struggling with the same problemVocation
Try this https://mcmap.net/q/131060/-open-facebook-messenger-in-android/1621111Aleksandropol
P
0
        String url = "https://m.me/fbUserID";
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(url));
        startActivity(i);
Paranoid answered 4/3, 2022 at 8:5 Comment(1)
While this code may answer the question, it would be better to explain how it solves the problem without introducing others and why to use it. Code-only answers are not useful in the long run.Ioannina

© 2022 - 2025 — McMap. All rights reserved.