Facebook new feed API access - android

I'm currently building an Android app that makes use of the Facebook API. I've gotten to the stage where I want to be able to retrieve a user's Newfeed i.e. the one you see at https://www.facebook.com/home.php. It seems that was possible using the /{user-id}/home endpoint but of course, that's now depreciated and they suggest using /{user-id}/feed but it seems entirely different since the home endpoint states
returns posts a person sees in their News Feed
however the feed endpoint states
links published by this person, or by others on this person's profile
which suggests the user's timeline instead.
Was that the only was of retrieving the newfeed? And is there any new endpoint I can use? I've tried looking already but it seems getting the user's newsfeed is no longer possible, is that correct?

Use feed. It's basically a replacement for home, but yes, it only gets the posts they are tagged in and such that would appear on their timeline.
They removed the functionality you're looking for when they removed home.
Documentation.

Related

How to get an access token from Facebook to use in my Android app?

I'm currently working on an android application that has an activity which is showing the timeline photos of a public Facebook page.
I'm using the manual token from the graph api explorer, however, now that my testing is done id like to replace it with one that does not expire after 2 hours OR find some way to refresh the old one every time it expires (I was thinking doing it whenever the old one gets 400'd).
The current URL I'm using to get the timeline photo album JSON is this:
https://graph.facebook.com/v2.2/xxxxxxxxxxx/photos?access_token= + MY_MANUAL_GRAPH_API_TOKEN
I need this token to get the JSON from the public timeline album (for the image urls), nothing else. I do not want anyone to log in or anything like that.
Any ideas? I've looked at the official Facebook Access Tokens documentation and other answers here but I feel like I'm not finding anything that's relevant to what I'm looking for.

Facebook API to do sentimental analysis

I am developing an android native application for sentimental analysis. The context is I need to get the information from the social media like Twitter and Facebook. I have done it for Twitter by using the API to get the 100 latest tweets about the particular organisation. That is fine.
Now I am trying to do the same for Facebook. Is there any free API available for this sentimental analysis.
I'm assuming to get the Twitter analysis working you used their 'firehose.'
If that is the case, and you're looking for a Facebook equivalent: it doesn't exist. Perhaps it's because the dynamics of these two social networks are not exactly identical and so what each is trying to achieve is different.
While some Facebook users' activities can be completely public (as per their choosing), most of the content is behind walls, so to speak. So unless you scrape the public info and do some analysis on it, as of right now there is no API support for what you're looking for.
If you're doing it for a particular organization they probably have a facebook page. Since almost all pages are public you can use the Facebook API to to query that page and get all the comments from that page. Once you have those comments you can perform sentiment analysis on them. The query might look something like:
$facebook->api("pageName/posts?fields=created_time,id,message,story,type,picture,shares,likes,comments.limit(5000)");
The above example is in php but you can find an equivalent Java example.
Since there is no stream like functionality for Facebook you would have to set, maybe a cron job, to run it every hour to get the latest comments.

Facebook SDK for Android: Trying to get a notification when one "likes/comment" the post made by my Android app

I'm fairly new to Facebook SFD for Android.
What I'm trying to achieve is an Android app that uses facebook login, post to the user timeline and gets notified whenever one is commenting or liking that post.
I went thru Facebook tutorials for login and for Publish to Feed.
All went well.
Now I'm struggling with the last part. I don't see how to be notified whenever there is a like or comments. I browsed the web and stackoverflow forum without any success. I'm guessing that there is a mechanism to be notified by Facebook and that I don't have to start a process just to monitor the post...
Anyone could give me a hint on the API to use?
I'm currently looking at "Creating Object Types" section Associating Actions with Object Creation (https://developers.facebook.com/docs/opengraph/creating-object-types) but it looks like this describes how to do for facebook web app, and not for android app.
EDIT
I've found this https://developers.facebook.com/docs/graph-api/real-time-updates/ but not quite sure how to "translate" this into Android coding.
If anyone could help me with this, it would be greatly appreciated.
I guess you have to create a page in php that will handle the responses from Facebook, it starts with a
GET response from Facebook that you retrieve with $_GET["name"] in php, and you have to send back a confirmation to Facebook to confirm that the connection works, and Facebook will send you the answer you want via
a POST request ( $_POST["name"] ) (with a json object, containing the informations about the user in object for example, and the different updates in entry).
You can put all these informations in a database, and when the user start your application, you can automatically connect him to a php script that check if the database has new informations for him.
(specifying who he is, with a user variable that he keeps in the memory of his device, and then you ask for informations from the database about this user). I haven't tested, but it should work.

Android: working with the Twitter search api

I'm working on an Android app that works intensively with the Twitter search api, retrieving twitts that contain certain keywords, and then tokenizing other words in them. My question is the following: form an architectural point of view, is it better to do all the work inside the app or to retrieve the information from a webservice? (I was considering this last option at f
first, but I'm afraid that even caching the results wouldn't be enough to bypass the limit rates of the Twitter api).

How to best add a comment/rating system to an android app

I already published an android app where you can see a list of specific objects and detailed informations about them. The list changes every day but some of the objects can appear again.
The application is communicating with a PHP server over HTTP and periodically pulls the list of objects.
I now plan to extend the app to make it possible to rate the objects and add a comment similar to how it is done in the android market. I'd like to avoid forcing the user to sign up for an account for being able to comment.
I see two problems:
The comment-system could be abused by spammers
A comment could be added from another system
So my questions are:
How to protect the system from spam?
How to authenticate the application with the server?
How do I limit the number of comments to one per user and object?
What about the androids device id? Is it unique enough to use it as identifier for the user?
Which other problems do you see?
2020 Commenting/Rating/Reviews Options
Since Socialize is out, here are a few options you can explore:
Build your own comment/rating implementation. Personally I love reddit and how it handles nested comments and ratings. Here's a library I found that implements it beautifully. Please note you'll need to tie this with a cloud-database. This is based on groupie. Article & implementation. Many ways to do this - https://stackoverflow.com/a/59472206/668240
Disqus - SDK's coming soon to iOS and Android.
BazaarVoice - commercial
Social Networks SDKs like Facebook, Twitter, etc. Personally I dislike this as we'll need to authenticate users with respective networks to use the APIs. It's like we are shipping off users of our apps to social networks. If you don't have a problem with that - then it might be for you
Legacy Option in 2014:
You can try out Socialize SDK which is open-source and a really good SDK for the rating and commenting you are looking for. It already has a well-functioning Commenting system built-in along with a 'like/love' facility and sharing to FB and Twitter. Each 'entity' (object in your case) can have metadata associated with it. So all you have to do is construct/use a rating widget, then send that rating with the entity attached to your object. To display your rating/comment is as simple as retrieving them from Socialize.
Each object (element from your app) should be associated with an entity which has a unique key in the form of a URL - sort of like a primary key to recognize your items. This entity can have meta-data - any data that you can insert on behalf of your object. Once you do that, you can retrieve that metadata any time you want.
I've been using Socialize for around a year now. They've matured over this period and are always aspiring to be the best at what they do.
Look at the Socialize Bar at the bottom. Its can be customized to your needs.
What's more - Socialize is free.
As for your questions:
There is comment moderation built into the Socialize Web Component
where you can filter out anything you feel is out of place.
Socialize allows you to authenticate through Facebook and Twitter.
Limiting to one comment per user can be achieved by using their User
and Comments API.
Socialize has both Anonymous authentication as well as Social A/c
authentication. I believe you can remove anonymous auth. So that
ensure that every user is authenticated before rating/commenting.
For authentication, you could use OpenID like StackOverflow does or Facebook authentication. Once you have them authentication, it shoud be easy to limit the number of comments to one per user per object. As far as spam, you could follow StackOverflow's model and allow users to vote comments up or down or flag as spam. Perhaps users with comments that have been voted up would have more power and be able to flag comments as spam.
You'll need some sort of rate limiting. I've used this one in this example before.
So you need a table with the user's ID and how many api calls they have left, and then when their last api call was. Then use the algorithm to update the values in the table every time a method is called.
Read through this, I think it should be possible to create an UUID for every case:
http://android-developers.blogspot.de/2011/03/identifying-app-installations.html
And then keep a hidden api key which is hard coded, or at least get's everytime calculated the same or in enigma style influenced by the time it is used. But you will be never be sure, that it won't be find out by crackers/hackers and maybe abused, you will always have this Problem.
Authenticate with the UUID of the user + api-key.

Categories

Resources