news feed from facebook wall to a android app - android

There is any way to get the last post's made on a facebook wall into a Android app? I want to make some like a RSS reader to get some information on the app.
To explain better-
I have a page on facebook about one football club and there I post several information about news, games etc. Now I have made an android app and my question is whether I can import the post into the android application?

Of course, you can. First of all, if you are new to facebook integration- read the basics of the android integration, login/authorization calling its APIs etc. (not complex at all).
Facebook provides many APIs (for different functions) that uses the access token.
Based on your requirement, you just need to use the API: /PAGE_ID/feed with the page access token to get the feeds of your page. The page access_token can be obtained with the API: me/accounts?fields=access_token,name (Demo) after the user authorization/login.
You can test this API here: Graph API Explorer, using the default token already present there.
Smarter way
(Without using the facebook API)
Since your requirement involves only back-end processes, you can use this method.
First of all, get the Long-lived page access token (that never expires). Detailed steps here. You can use the short-lived token from here.
Use this token and make a \GET request to :
https://graph.facebook.com/PAGE_ID/feed?access_token=TOKEN_FROM_STEP_1
(You can check the result in the browser)
This is it!

Related

Is possible to synchronize a particular facebook page onto an android app?

I was wondering if it is possible to catch feed of a particular facebook page without any authentication and just display all the posts posted by the admin of the page (possibly along with all comments and likes).
I took a look the facebook developers page but could not find anything relevant.
You can access the public information of any Facebook page without any permissions.
However, You do need to register your app on FB first. They only allow access to their Data from registered apps. It's FB's way of making sure they know who's using which data and how much of it.
You can create a new app at this URL
https://developers.facebook.com/apps
Here are links to mobile/web docs for using Facebook's API
https://developers.facebook.com/docs/

Using Facebook scores API in an Android App?

I am integrating the scores API for facebook in an Android game. I had the exact same problem as this question: Facebook Graph API Explorer won't POST scores. The fix was to set my app as Web instead of Native/Desktop. Is it because scores API should not be used by native games? Is it somehwat dangerous to set up Web for a Native app?
Thanks
I have noticed this too, however I wondered if it is 'by design' as to use the Facebook Scores API you need access to the app access token (in order to do things like submit scores) however this isn't considered a safe thing to use from a native application. Here is a quote:
"App Access Tokens should only be used when the posting functions are originated directly from your servers in order to keep them private to the app. For example, you should not publish using an App Access Token from within a native mobile app. Doing that could allow the user to obtain the App Access Token, which could then allow them to take actions on behalf of your app. Instead, you should have your native mobile app queue actions up with your server and then have your server publish the stories to Facebook using the App Access Token."
Here is the website in question: http://developers.facebook.com/docs/opengraph/using-app-tokens/.
So, it sounds like the only way to really use the Scores API is to have the native application securely talk to a separate, secure, server (potentially on Heroku) then once that server has verified the passed data, it would then talk to Facebook and submit the score using the app access token (which it can safely use without the user getting hold of it).
On top of this, the Facebook Scores API only supports having one score per application (not per level, per mode, etc.) scores, so in order to have anything more advanced the extra server is required anyway, so a database can be stored that maps Facebook user IDs to the various scores one wishes to score.

How to interact with web application from android application?

I have a Java based web application which is developed using JSP/Servlets running on Tomcat server. This application is developed for customer support. A customer can directly login to the application with his credentials and raise any complaints reg. a specific product. He can also view all the complaints he has raised and their status. Also he can add comments to the complaints and also close them when he desires to.
Now I would like to develop an Android app where a customer can login with his credentials and do same operations as he used to do in the above said web application.
I have basic knowledge on Android and good amount of knowledge in Java. Can someone help me with some guidelines or sample source code to develop such kind of application. In particular after authenticating a customer with his credentials from an Android activity by sending HTTP request to the web application, how do we keep track of the session for that customer in order to display him the complaints raised by him or allowing him to add comments to his complaints in next activities (screens). To put it simple how to maintain sessions?
Thanks,
You question is pretty specific to your application. How you maintain a session with the server is pretty much up to you, but you can think of it as implementing the relationship between a web browser and a web server.
After your user logs in, the client should receive some kind of token from the server (similar to a cookie). All subsequent requests will pass along that token to authorize the user, so you'll have to persist it on the device. Your server will have a mapping of tokens to users.
I would recommend looking into OAUTH2 and maybe taking a look at some well used APIs like Twitter and Foursquare for some ideas about best practices.

Facebook Android SDK Wall Stream

I am developing an application for a client who wishes to display their Facebook wall posts in the application. The Facebook SDK examples do a wonderful job explaining how to allow users to sign in, but this is not the functionality I desire. I only wish to stream information from a single profile for all application instances without any users having to sign in. If anyone has done anything similar, I would appreciate your suggestions. I will gladly provide any additional details.
One option would be to embed one of the social plugins inside a web view. Otherwise, you could embed an application token inside the application and then make a graph api call to /pageid/feed and use the json result to show the feed entries.
Your client can also create a page which is public and then just get its feed simply via RSS, no need to sign-in and no need for access token in this case. Url for RSS feed should be:
https://www.facebook.com/feeds/page.php?id=PAGE_ID&format=rss20
hope this helps

Read from Facebook wall (public) in an Android app, without user signing into Facebook?

I've seen copious discussion about how to extend an Android app so the user signs into their Facebook account, and can then access the graph etc.
However in my scenario the app only needs to access public data, e.g. wall posts from a public figure whose wall is freely available, even on the Facebook web site to people not signed in. I do NOT want the Android app user bothered with requests to sign into Facebook, when they don't need to.
Can you point me to a sample that does this, or some pointers on how to approach this? I have a set of SDKs I can choose from, but want to understand how I will use the API. I assume some kind of authentication is probably necessary so Facebook can track the source of the requests, but the access used must be read-only as the auth details will be distributed inside the app. Hopefully there's something akind to a Twitter read-only application.
I think this is something you can do pretty much without using any other API than HTTP found on SDK. You can get public data using plain HTTP/S request and then creating a JSONObject from response;
http://graph.facebook.com/facebook/feed
In which facebook' is the user id.
As for code example should you find good examples for making a HTTP request easily. And for further error checking I would recommend taking a look on Util class in official Facebook Android SDK, parseJSON method especially in which errors returned as a JSON response are handled.

Categories

Resources