I try to develop an android app, that displays posts of a public Facebook page and enables logged in users to like these posts.
I tried to use the POST API call /{object-id}/likes, but as of version 2.8 of the Facebook API the documentation says, that ...
... as of Nov 17, 2016 [Facebook] changed the behavior of publishing likes and only support this action with Page Access Tokens.
My first guess is, that Facebook does this to avoid apps from abusing the "like" feature. In my understanding it's only possible to like posts on pages, where the logged in Facebook user also has page access rights (a Page Access Token) to. That seems to be a very restrictive option that impedes the possibility of an app to like posts.
I also tried to use the LikeView (as recommended in the Android sharing documentation), but that seems to only work for external links, which seems to be an Open Graph object. The documentation says:
The Like button can be used to like a Facebook Page or any Open Graph object and can be referenced by URL or ID. [emphasis added by author]
When I use the LikeView on Facebook links, as returned by the /{page-id}/posts (link attribute on returned objects), the web view popup closes immediately after clicking on the LikeView button.
I'm posting this question, because I can't find any suitable information for liking Facebook posts (especially as of v2.8) via a custom Android app, even though (I think) this should be a basic feature because on Facebook liking things is one of the most used features.
Disclaimer: Sorry for not linking to more Facebook documentation references, but because of my reputation I'm not allowed to post more than one link.
You found the relevant info already: It is not possible any more via API.
It was possible up until now, but now they removed it, because it was abused too much.
https://developers.facebook.com/docs/apps/changelog#nov-17th--2016:
Deprecations
The Graph API behavior of POST and DELETE to {object-id}/likes has changed to only be accessible for Page Access Tokens. You can read more about this in our docs.
That means, only liking in the name of a page is still possible; but not any more in the name of a user.
Related
The app can redirect you to the FB page in question and get you to press the like button. Trying to understand if that can be done quicker. Tks
No, that is not possible.
Facebook allowed liking certain object types in the name of the user via API until a while ago - but it has been removed since, simply because the feature was abused too much.
And Facebook pages could never be liked via API, that has always been possible via the official Like buttons only.
What controls the Twitter access rights?
Is it the Twitter application as defined in my Twitter dev account?
Is it the Twitter Android API ?
Is it the TwitterLogin plugin info provided by Fabric.IO?
Is it a combination of these?
Is it something else?
Using Twitter as a Way to Identify User
All I want to do is use the Twitter OAuth which is provided by FabricIO and the TwitterLogin infrastructure so I can identify a user. In other words, let the user sign on using Twitter. However, I don't need or want more access to their account.
However, as you can see in the image below, the app seems to gain far more access to the user's Twitter account than I need.
Possible To Change?
Is it possible to change this so it is very limited? If so, where would I make those changes?
I just found the settings in my twitter dev account and it resolves some of this, but not all. However, maybe this is all it is even possible to control??
Go to https://apps.twitter.com/ (it'll take you to your twitter dev account).
If you have more than one app, choose the app you want to change.
Click the [Permissions] Tab.
You will see something like the following images:
Mine was set on Read & Write (2nd choice)- Image shows where I have now selected the Read only choice.
Click the [UPdate Settings] button and you get the odd screen that follows:
That made me think I hadn't chosen the correct choice (read only).
Finally, after a few minutes I refreshed the app settings web page and saw that it was on Read Only.
I then tried logging in using my Android application again and it now looks like the following:
Now, it cannot tweet for the user nor can it add users. It still seems a bit intrusive though, just to use it for Authentication.
I would like to integrate Facebook into an application - enable login using Facebook credentials (Single Sign On, to login to a third-party service), and also share some wall posts.
The problem is, I don't want to depend on the installation of the official Facebook app.
I heard about some solution involving opening Facebook login from a WebView, but didn't find details.
Anyone has experience with that?
Thanks
Yes you can do it using the OAuth for getting permission, then use the Graph API to post on users walls.
Please see this link for OAuth: http://developers.facebook.com/docs/authentication/
And this link for Graph API documentation:
http://developers.facebook.com/docs/reference/api/
especially for posting http://developers.facebook.com/docs/reference/api/post/
All Facebook APIs built on the idea that you perform request from a particular application (identified by application id). So the answer is NO, you cannot perform API queries (as well as authentication) without having registered an app.
I'm having some problems with facebook integration on my android app. I've looked at the examples that come with the api and i can do the things shown in those ok. But i'm having problems with other things such as getting single sign on to work properly, authentication across multiple activities in the app and loading a facebook page (non-api call) without being asked to log in again.
Anyone have examples that show these?
When making API calls, you usually need to include the access_token parameter that was issued when the user authenticated. This is how facebook knows who you are when you make requests.
Similarly, when loading facebook pages (not using the API), you have to remember to send the cookies Facebook sent when the user logged in. Normally the browser keeps track of these automatically, but in your program or app you might have to handle them manually.
I don't have experience with Android specifically, and I don't know what you're using to load and render facebook pages, but knowing how facebook is keeping track of logged-in users should give you an idea of where to start. A google search or two should get you on your way.
Go to facebook.java class and change package name com.facebook.katana to com.facebook.katanaaa or any one of your own choice. This worked for me .
I'm adding social integration to my app, and am looking for general advice how to go about it.
At the moment the app is showing feed of particular Facebook wall (authentication handled by Facebook's Android SDK) and feed for particular Twitter hashtag. That's a start, but I want these feeds to do a bit more. For Facebook:
For long feed items, user should be able to "see more", including linked pictures
Links inside feed items should work and open in browser
Like/unlike feed items
Comment on feed items
Post on the wall (create another item in feed)
Similarly, for Twitter:
Links inside tweets should work and open in browser
Reply to, and retweet tweets
Create tweets that contain the specific hashtag
Since Facebook and Twitter both have comprehensive APIs and there are enough code samples floating around, this is all technically doable, but seems a lot like reimplementing Facebook and Twitter clients. That's a lot of work to get all the little details right, maintain code for API changes,
and not really in the scope of my app.
So I'm thinking how to avoid reimplementing Facebook and Twitter clients.
Idea one: direct user to mobile versions of the respective sites and be done with it. Downside is that user will have to go through cumbersome authentication, even if there are dedicated client apps already installed and authenticated on user's device.
Idea two: plug into existing apps using intents system: if official Twitter app is installed, use that to do hashtag search. If Seesmic or Twidroid or some other twitter client is installed, use that. As a fallback, open Twitter's mobile website in browser. Similar for Facebook. Downside here is that intents for "show facebook stream" or "search tweets for X" are not standartized. Most current apps don't even have documented ways to plug into them. Using undocumented entry points in those apps is possible but would make my app hacky and brittle.
So, this question, how you've been dealing with integrating bits of Facebook and Twitter functionality in your apps, or seen done by others?
Here is a good tip about how to implement twitter/facebook oauth:
Create new activity and name it OAuthActivity.
Create new class that extends WebView.
Follow the facebook developer guide for WEB applications (not mobile ones!) and implement oauth calls inside of your WebView. For Twitter use Signpost-core with signpost-commonshttp4 to get oauth (facebook uses its own variation of oauth so you need to do it yourself).
Override WebView so it closes itself when facebook redirects your WebView subclass to your callback url.
Use OAuthActivity to return OAuth key / secret to your main activity via RunActivityForResult.
This way screen orientation change will work; you will have same architecture for FB and TW.
I have implemented it this way, yet I can not share my code (it is licensed for my company).
When I added Facebook and Twitter integration into my app (shameless plug: Secret Message), I attempted to invoke an installed Twitter client app via Intent. It wasn't fun, because there is no such thing as a "facebook/text" or "twitter/text" Intent. I know some Twitter apps create their own, but they're not universally used or even known.
So the other option is to get a list of all installed apps and filter on those you want to display in a chooser for the user to select. But retrieving a list of packages and their user-friendly names takes forever. So I hated that option.
I ended up integrating a very simple GUI for both Facebook and Twitter into my own app, and just used OAuth to authenticate users.
I hope this helps you pick your direction.
implementing Twitter integration is pretty easy on Android (you can use Twitter4J which is a pretty nice Twitter Java Library to access the public web services).
To integrate tweeting/retwreeting is basic stuff once you have authenticated your twitter user (just have a text box to allow users to enter thei 140 characters and a button to submit it - creating tweets, retweeting, replying etc is all a matter of 1 or 2 lines of code using twitter4J). The link stuff requires formating your listview to handle weblinks and open as appropriate.
The toughest part of the whole twitter integration thing is getting the OAuth stuff done - there is a tutorial on how to implement twitter and the OAuth authentication stuff here
Unfortunately, I have never tried facebook integration, but hopefully someone will be able to help out with that.