Ilya Gazman
Ilya Gazman

Reputation: 32231

Android: Open Messenger chat view with specific person

There are few questions about opening a messenger chat with a specif person, and the answer to all of them is not possible.

But the Facebook app does this. When clicking on a friend icon at the top right corner and picking one of the friends, it opens a Messenger-chat with that person.
So how do they do it? I have been trying to find some intent they pass, but I saw nothing.

Upvotes: 1

Views: 2629

Answers (2)

Md Shakil Ahmed
Md Shakil Ahmed

Reputation: 1

After doing some research came up with this:

    Intent mIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb-messenger://user/" + "myapp"));
    startActivity(mIntent);

Hopefully, it would save your time. 😃

Upvotes: 0

Jimmy Ma
Jimmy Ma

Reputation: 21

Try this:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setPackage("com.facebook.orca");
intent.setData(Uri.parse("https://m.me/"+"FacebookId"));
startActivity(intent);

Upvotes: 1

Related Questions