Like a Facebook Page Programmatically - android

I search google for this problem but I didn't understand answer I found.
Actually I want to Like page grammatically like I can post a message on Page behalf of user.
I have Long term access token getting it from my app.
I have an android app where user can login through facebook account and that time I asked user for the Post permission of facebook.
So how can I do it?

I implemented simple library which allows you to add Facebook 'Like' button easy:
dependencies {
compile 'com.shamanland:facebook-like-button:0.1.8'
}
Read more details here.
The simplest way to add like button:
<com.shamanland.facebook.likebutton.FacebookLikeButton
style="#style/Widget.FacebookLikeButton"
app:pageUrl="http://url.to.like/page.html"
app:pageTitle="Title of page"
app:pageText="Short description of page"
app:pagePictureUrl="http://url.to.like/picture.jpg"
/>
This view will be drawn in your layout:
After clicking on it you will see the dialog with official Facebook 'Like' plugin.

Hi in the Facebook SDK for the Android it is only possible to Share something not to Like. if you want to Like page you should use WebView and use Iframe in it to display like button.

Related

Easy Facebook Android SDK : How to like a Page

I am using Easy Facebook android SDk v2.3. I could successfully access a page and get details of page including number of likes.
I am trying to implement like button in the app using setLikes(String likes); method of Page class but getting confused with what is to be passed as the parameter.
Sample Code :
p = Global.graphApi.getPage("Page ID");
p.setLikes(String likes); //what should likes be replaced with, replacing it with user id didn't work
Any help on this is appreciated.
According to the facebook documentation, (Page), you cannot like a Page via Graph API, even though you can read the like count information.
User, have to press the like button himself to like the page.
The accepted answer here may help you: like android application page in facebook from application itself

Add Friend through Facebook Dialog - Android Facebook SDK

I am currently developing an Android app using the Facebook API. One module of my application consists in adding a friend (knowing the ID) and I would like to add a friend through the FB Dialog object.
I used the Facebook object with dialog method:
http://developers.facebook.com/docs/reference/androidsdk/dialog/ .
as well as the FbDialog class to try adding a friend through a dialog:
http://developers.facebook.com/docs/reference/dialogs/friends/ .
However, as it is written in the documentation only feed and oauth are supported through this dialog. As a consequence, when I use this dialog trying to add a friend, either it redirects me to my browser and the AddFriend web dialog, or it successfully open a dialog but with a message saying that this is not supported.
My question is: is it possible to have this dialog working with the Add friend mechanism in spite of what the documentation says? Maybe one of you guys has found a trick to do so. Or maybe it is just not possible, and I have to stay with this method (that is opening the web browser), which I find not very user-friendly for my app.
Thanks in advance!

Android: Is there a way to make facebook.dialog less ugly? - Screenshot attached

I'm very close to having what I need for my facebook dialog, the post is working successfully, which has taken me a fair amount of time as i've struggled with the facebook sdk.
When I open the dialog to post a message to the feed ( or when I call authorise in a dialog ), it shows as shown here:
http://minus.com/mg6utFaHf
I'm looking for something more like this:
Any ideas why mind is showing so... ugly?
It's very square, in a webview, with the X in the top left.
Thanks, any help is much appreciated.
The new Facebook SDK should allow you to use the built in Facebook app to do such things via intent.
In alternative you could use the Intent ACTION_SEND to achieve what you want.
The new SDK of theirs implements a way of authorizing called Single Sign-On which searches the device for the presence of the Facebook app and sends an Intent to that app which will authorize for you. If the Facebook app is not found then it will fall back to the dialog method.
You'll still be stuck with square iOS-y like design for in app sharing, invite friends, etc. The only way I can think of getting around this is to use FQL but how to do that is beyond my knowledge.
http://minus.com/mg6utFaHf is just the standard facebook Feed dialog ... see https://developers.facebook.com/docs/reference/dialogs/feed/ ... just change www. to m. as for example https://m.facebook.com/dialog/feed?app_id=123050457758183&link=https://developers.facebook.com/docs/reference/dialogs/&picture=http://fbrell.com/f8.jpg&name=Facebook%20Dialogs&caption=Reference%20Documentation&description=Using%20Dialogs%20to%20interact%20with%20users.&redirect_uri=http://www.example.com/response
Said that if you want it different you have to implement UI and post data by your own by Graph api

Facebook Login dialog for mobile Web using oAuth

The facebook technical documentation looks like an ape threw it's own excrement at a website - and that's how useful it is too...
So I have this web app (for android devices) and I need to authenticate using oAuth (since facebook's "kaleidoscope API policy" requires that their APIs are never the same if you look at them twice).
I need to show the login screen and I would like it to open in a dialog box rather than a whole new page, since multiple pages aren't supported on all android devices.
This is what I have so far:
HTML:
<fb:login-button></fb:login-button>
Javascript:
FB.init({appId : XXXXX,status : true, cookie : true,xfbml : true, oauth:true});
Right now I get the full size PC style login dialog, but I want the nice pretty touch/mobile dialog. Any ideas?
You can fix the issue by using a link that they recommend with a slight modification:
Their Link:
http://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&display=touch
Your Link
http://m.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&display=touch
Notice the change of www to m.
Have you checked out the Facebook SDK for android? It has full source code. It also use oAuth and show complete Facebook dialog. Here is link
https://github.com/facebook/facebook-android-sdk/

How to share my links to facebook twitter

I am new in android...i have given a task to do..i have provided an textView where my link is present..i have two buttons..on with named share in facebook and other with named share in twitter..what i have to do is when i click on any of the button at first the login page of each of the facebook or twitter is opened depending upon the button click..now when the user loged in..the link present in the textview is automatically shared on the facebook..so can anyone suggest me how to do this..if possible with example..
regards
Rahul
Facebook Dev Docs
Twitter Dev Docs
Do a little search, and you will get quite a few examples.
This can be done by getting Facebook and Twitter libraries to your project. Then make object of Twiiter and Facebook classes and perform the tasks with the help of that objects.

Categories

Resources