integrate facebook with like button in android and iphone
Asked Answered
P

3

8

I want to integrate facebook with like button in android and iphone. I integrated facebook in android and iphone also but i didn't integrate like button . So please tell me how to integrate the facebook like button in android and also in iphone.

For integrate the facebook i used below link example in android

https://github.com/facebook/facebook-android-sdk

Now i have to integrate the facebook like button.

Best Regards.

Thanks in advance.

Papke answered 9/5, 2011 at 9:36 Comment(1)
Do you have a more specific question in mind? Or are you just trying to get someone to write it for you?...Engelbert
C
4

There is no like button in facebook graph api. There are some alternatives that you can select. First you can use a webview and show the like button in a webview.

https://developers.facebook.com/docs/reference/plugins/like/

Another alternative is using facebook share functionality in facebook-android-sdk.

Last and more general alternative is using an intent and let the user select how to share it. (it can be any app including facebook)

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "YOUR SUBJECT HERE!");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "YOUR TEXT HERE");
startActivity(Intent.createChooser(shareIntent, "YOUR TITLE HERE"));
Cystotomy answered 9/5, 2011 at 10:55 Comment(1)
Using the intent doesn't work, beacuse the Facebook for Android app is broken and doesn't handle the intent in the correct way (the message is not populated).Eros
M
5

Check out this nice bit of code: http://angelolloqui.blogspot.com/2010/11/facebook-like-button-on-ios.html

Add the FBLikeButton class to your view:

FBLikeButton *likeButton = [[FBLikeButton alloc] initWithFrame:CGRectMake(0, 372, 320, 44)  
andUrl:@"http://www.facebook.com/pages/De-Zilk/108209735867960"];

Thanks a lot Angel García Olloqui

Matrona answered 4/10, 2011 at 9:37 Comment(0)
C
4

There is no like button in facebook graph api. There are some alternatives that you can select. First you can use a webview and show the like button in a webview.

https://developers.facebook.com/docs/reference/plugins/like/

Another alternative is using facebook share functionality in facebook-android-sdk.

Last and more general alternative is using an intent and let the user select how to share it. (it can be any app including facebook)

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "YOUR SUBJECT HERE!");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "YOUR TEXT HERE");
startActivity(Intent.createChooser(shareIntent, "YOUR TITLE HERE"));
Cystotomy answered 9/5, 2011 at 10:55 Comment(1)
Using the intent doesn't work, beacuse the Facebook for Android app is broken and doesn't handle the intent in the correct way (the message is not populated).Eros
C
4

From:

http://developers.facebook.com/docs/reference/api/

(I've removed the https prefix from the graph urls since I don't have enough stackoverflow rep to post more than two hypelinks..)

Publishing

You can publish to the Facebook graph by issuing HTTP POST requests to the appropriate connection URLs, using an access token. For example, you can post a new wall post on Arjun's wall by issuing a POST request to graph.facebook.com/arjun/feed:

curl -F 'access_token=...' \ -F 'message=Hello, Arjun. I like this new API.' \ graph.facebook.com/arjun/feed

The Graph API reference provides more detailed information on the supported arguments and their corresponding values.

You can comment on or like any object that has a /comments or /likes connection by posting to graph.facebook.com/OBJECT_ID/comments and graph.facebook.com/OBJECT_ID/likes, respectively:

curl -F 'access_token=...' graph.facebook.com/313449204401/likes

Most write operations require extended permissions for the active user. See the authentication guide for details on how you can request extended permissions from the user during the authentication step.

Cytogenetics answered 11/5, 2011 at 9:26 Comment(2)
Also note that, according to the below post, and from my work, you can't 'like' an FB page, just posts, comments and photos ... #5837510Cytogenetics
this is related with this bug bugs.developers.facebook.net/show_bug.cgi?id=10714#c46Guanine

© 2022 - 2024 — McMap. All rights reserved.