0

Can anyone help me to get public photos from a Facebook page. I'm developing a mobile app using Xamarin.Forms in which I need to get public photos from Facebook.

Currently I'm using Xamarin.Social to integrate Facebook in the app and I'm able to login into a Facebook account but not able to get public photos.

Sami Kuhmonen
  • 30,146
  • 9
  • 61
  • 74

1 Answers1

0

Use the Xamarin.Auth to query the relative facebook API link. For Example, to get the user name and ID you can use:

var request = new OAuth2Request("GET", new Uri("https://graph.facebook.com/v2.4/me"), null, _currentUser);
            await request.GetResponseAsync().ContinueWith(t =>
                {
                    if (t.IsFaulted)
                        return;
                    else
                    {
                        string mail = t.Result.GetResponseText();
                        Dictionary values = 
                            JsonConvert.DeserializeObject>(mail);
                        bool s = values.TryGetValue("name", out _name); 
                        bool i = values.TryGetValue("id", out _userId);
                        if(!s){
                            _name = "Error Getting Username"; 
                        }
                        if(!i){
                            _userId = "Error Getting Id"; 
                        }
                    }
                });

To explore the Facebook API you can follow this link

Hope this helps.

Rao
  • 20,781
  • 11
  • 57
  • 77
Joe
  • 129
  • 2
  • 9