1

I am developing an android app using Parse. When a user registers I store his/her Facebook ID in a column. I have an option in my app where Facebook friends can contact each other using the fb messaging app.

I am using the following code to open the messaging app directing to the correct user:

String id = user.getFacebookId();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("fb://messaging/" + user.getFacebookId())));

enter image description here

When I use this ID as follows: https://www.facebook.com/10202537137382370 , it takes me to the correct profile. However when I use it in the code block above I get the following loading screen:

enter image description here

There is a website that allows you to get the id for a user: website. This website gives me a different Facebook Id than the one I've stored in my Parse database. When I use this ID in the code block it works.

Why does this happen and how can I fix this? Thanks in Advance!

Jdruwe
  • 3,450
  • 6
  • 36
  • 57
  • 2
    Where in the Facebook documentation does it say you can use fb://messaging/{userid} ? Just curious because if it exists we should remove it. The reason your code don't work is that you have an app scoped user id and the fb://messaging/{userid} doesn't work with app scoped user ids – WizKid Oct 15 '14 at 19:25
  • Shouldn't you be using the message dialog for this? https://developers.facebook.com/docs/android/share/#message-dialog – Igy Oct 15 '14 at 19:27
  • 2
    I did not know there was a difference in id types. Is there a way to transform the id? Can I use the message dialog to send a message to a specific friend or do you always need to select 1 manually? – Jdruwe Oct 16 '14 at 06:16
  • @Jdruwe did you solve this problem? I am also facing a similar problem and it seems there is no way to launch messenger with user id. – vipul mittal Aug 07 '15 at 06:59
  • No I did not, there is no way fb allows it :( – Jdruwe Aug 07 '15 at 07:16

0 Answers0