android:Get photo from facebook post using graph api - android

I'm using Graph API in my android app to get posts of a facebook page.The result is JSONObject.
Posts are of 3 types - status, link, photo
For a post of type photo contains a picture which is available in the page album.
I'm loading this image from the picture field(typically a web URL) in the response json object. However the image is of poor quality.
To get the original picture, I should get it from the album/photos of the page.
Problem: The problem in the second case is, How do I get the id for that picture from the post? to query it from the album.

The id is in the field object_id in the json.
You have to make an additional call with this ID then.

Related

How to get JSON data from reddit after the first page

So I am currently making an app to work with and learn more about JSON (using GSON) and decided to go with a reddit browsing app. I am currently able to get the JSON data by using "http://www.reddit.com/.json" and this will get me the JSON for the first 25 posts. I am trying to get the information for the next posts by using
"http://www.reddit.com/.json?count=25&after=" + name_of_last_post
which name_of_last_post is the name field from my GSON for the last post. This however just brings up the first page's posts again with their numbering starting at 25, I get that the numbering starts at 25 because count is set to 25. What I am asking is what is the format of the string I can create to get that next set of JSON items. you can try this your self by going to reddit.com/.json and taking that into a json editor and formatting it nicely than going to the next page of reddit and adding .json before the ?count=25&after=, you will see that the text following after= does not seem to appear on the first JSON file anywhere. If there are any parts of this question that are still unclear please leave a comment and I will check in on it later. Thanks and have a great day.
There are a couple of fields that you can use in order to fetch the next page on JSON.
You could either retrieve the 'name' of the last post, or instead of parsing the whole block, you can retrieve the last couple of fields from the JSON that reddit gives you. There are a couple of fields that you can easily use to navigate pages forwards and backwards, they're conveniently called 'after' and 'before'
Having that value, you can mount your URL with it, which in this case is http://www.reddit.com/.json?count=25&after=t3_3gi42o
This will get you a new JSON, with different 'after' and 'before' fields, pictured below:

ANDROID - display image and text from separate web service calls

I need your advice or ideas regarding my problem. The app I'm working on needs to display an image and text from two separate web services. The first web service (image) returns a base64 encoded string and the last web service(text) returns a plain json response.
Some samples I found on the web is that they only use one service to display the record with the the string url of image something like this:
[{"id":"1","version_name":"Alpha","description":"","version_code":"1.0","api_level":"1","image":"http:\/\/www.test.com/img/cupcake.jpg"}]
But in my case, the client has given me two separate calls to view the data (details) and image:
[{"id":"1","version_name":"Alpha","description":"","version_code":"1.0","api_level":"1"}]
for image Base64 String result (SAMPLE):
"iVBORw0KGgoAAAANSUhEUgAAAGQAAABfCAYAAAAeX2I6AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAACxIAAAsSAdLdfvwAAEc8SURBVHhezb13dBzHmT3qc37nvV1bXq+9tvfn9Xpt79q78tpWdJAsKllWJsWcwRyRc2QQgyiJogIpkiIJEDkMcmLOOSeJOZPIwOQ8gxkAvO9+NWhwBIE0Kck+7497uru6urr7u/Wl6urub+g6SpDfVYIcVHBZhbxblfeMXHCJUuR0ViC7s0ohE9VIJ1az/DbKWFahkMFj1nI7u6sCeV21yL1VhbLOYuhQjOqOXNShAFbWcHV9AheXdmQpOJANJ5ceLt08i8BxK5/7ctU+B/e5b+XB2ZlD5MLZlUVksp1suG6xjOsCtzo+B/ZbRTymGLauPK6znVuFatsh52c9gQNFsHUSXflcl3Pksb1cIl+16brF9rpKed5CgudUbRSptgLtFdwznDze0VmAr0RINoWbyZvIoNBzb1HAJCansxzZt8qR21V9G6ybc6usBxm
To display this in a listview, how would I display them at the same time? How would you create a workaround for this?
I would truly appreciate your help. Thanks.

Why I am getting zero values for Facebook page status read?

I am facing problem in getting Facebook data
I am using Facebook SDK for page status read, for this I am using the following URL :
https://graph.facebook.com/gennextapps/statuses?limit=50&access_token=" + access_token
At first I am getting values, but, after two times I am unable to get the values.
Is there any difference between statuses and feed in URL?
The statuses and feed are two different things. "Statuses" are only the items posted by the page, while "feed" includes items posted by others.
I found this page documentation
Statuses: An array of Status message objects. The Page's status updates.
Feed: An Array of Post objects containing (up to) the last 25 posts. The page's wall.

How will I Login to facebook and comeback with name and phone number from android application?

Actually I need to login facebook and come back with contact,picture and phone number of my friendlist?
Still, I have not got the trick to get friends phone number.
Get json array of id.then parse it to get individual id of friends.
String info = mFacebook.request("/" + id);
Now u will get all the information about your friend.
Use this url to get friend pic
Click for Image
All the data that is returned can be browsed here: https://developers.facebook.com/tools/explorer/?method=GET&path=161193133389
This example is for coke, but any id will work here, so if you do /me you get the info about the logged in user.
me/friends will show you the user's friend ids:
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Ffriends
Then you can subsequently fetch information about each user at graph.facebook.com/
The important thing to remember is that you have to ask permissions to get certain data, but you'll get errors if you try to get something and can't, so it should be easy to figure out what you need.
Thanks Akki Its really working......
Actual code i ussed here is
imageURL = "http://graph.facebook.com/"+id+"/picture?type=small";
bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageURL).getContent());
And I got the bitmap image.

Cannot Facebook "Like" with Graph API's /OBJECT_ID/likes

I'd like to implement a like button in my Android app. The Graph API doc sais publishing likes can be done with /OBJECT_ID/likes.
/OBJECT_ID/likes
Like the given object (if it has a
/likes connection)
However if i implement this:
Bundle par = new Bundle();
par.putString("access_token", ACCESS_TOKEN);
facebook.request(APP_ID + "/likes", par, "POST");
it just does nothing but returns an empty (data content) JSON array. (publish_stream permission is given.)
APP_ID is my app's FB id, and i guess it'd be the OBJECT_ID so i don't understand.
How can i implement then a Like button?
You cannot force users to like your application or your fan page (due to spamming reasons). The only way you can get them to like your page/app is embedding the like fbml code or iframe in a web view. That documentation is in place to like a friends wall post or comment or photo, as those are the types of items you can like for a user, in case for example you were writing a Facebook client. If that is what you are trying to do, don't send the app_id as you are doing, but send the post id of the users post.

Categories

Resources