GithubHelp home page GithubHelp logo

Comments (17)

soneff avatar soneff commented on April 24, 2024

Could you provide a bit more detail? How are you generating the content for the WebView, or what URL are you trying to load?

from facebook-android-sdk.

JohnWeidner avatar JohnWeidner commented on April 24, 2024

I tried using the iframe code provided by the like button code generator at http://developers.facebook.com/docs/reference/plugins/like. But since an iframe is basically the same thing as a WebView, it seemed redundant to load the code in an iframe and then load the iframe in a WebView. So instead I just loaded the code that would be in the iframe directly into the WebView using the code below. But the same thing happens either way.

private initLikeButton( String urlToLike ) {
    likeWebView = (WebView) findViewById( R.id.likeWebView );
    likeWebView.getSettings().setJavaScriptEnabled(true);

    String url = "http://www.facebook.com/plugins/like.php?" +
           "href=" + URLEncoder.encode( urlToLike ) + "&" +
           "layout=standard&" +
           "show_faces=false&" +
           "width=375&" +
           "action=recommend&" +
           "colorscheme=light&" +
           "access_token=" + URLEncoder.encode( FacebookAdapter.getInstance().getAccessToken() );

    likeWebView.loadUrl( url );

}

Incidentally, the same issue exists when developing an iPhone app. We don't want the user to have to login to facebook every time they run our app. But unfortunately, if the user has logged into facebook on another computer since the last time they logged into facebook via our app, they'll have to log in again.

On the android platform I would think a better solution might be to have a facebook app that you send an intent to that takes care of keeping the user logged in and returning the html for rendering the like button.

from facebook-android-sdk.

soneff avatar soneff commented on April 24, 2024

OK, I see, nice trick. Looks like the issue is that there are several types of Facebook cookies, and the one that the Android SDK uses in the WebKit webview is not the same as the one used to implement the "Like" button on the web, hence the need to log in again. I'll find someone who know more about the cookies and see if they can propose a solution.

from facebook-android-sdk.

soneff avatar soneff commented on April 24, 2024

Correction: the Facebook Android SDK dialog (such as the login dialog) and the "Like" button currently use the same cookie: a c_user cookie. You are quite right: with a c_user cookie, there are a limited number of sessions that may be active (up to five where the user has checked the "Keep me logged in" button, but only one if they have not), so if the user logs in elsewhere, it may invalid the c_user cookie on the device, requiring the user to log in again when trying to display a like button inside a webView dialog.

Using intents or a similar technique, such as creating a "like" dialog type supported by the SDK, or using a different cookie that does not get invalidated or expire, are potential solutions: I'll ask the relevant people what can be done, but I'm not sure if there will be a quick fix....

from facebook-android-sdk.

ayanir avatar ayanir commented on April 24, 2024

Hello,
is posible to use the Graph API to implement the "Like" methode same as the "me" etc.?
if it is possible then we can just use the relevant String action.

from facebook-android-sdk.

EvgenyAndroid avatar EvgenyAndroid commented on April 24, 2024

Hi John,

Have you managed to solve this problem? I'm currently using WebView and graph API with OAuth to get access_token etc.... however as you know Like is Open Graph protocol and yet not supported on Mobile....

Any idea how to implement it?

Cheers,
Evgeny

from facebook-android-sdk.

bgold avatar bgold commented on April 24, 2024

Using a WebView with a Like button in it is buggy and unsupported, and is broken if your app uses single sign-on. We're working on a better solution and will let you know when it's ready.

from facebook-android-sdk.

olgatchoum avatar olgatchoum commented on April 24, 2024

Hi,
Is it possible to use the Like button as the social plugin does, from the Android SDK?
It would be just great to use it with an mFacebook.dialog(...)...
Cheers,
Olga

from facebook-android-sdk.

mdpedersen avatar mdpedersen commented on April 24, 2024

Hi,

Brent, could you tell us if there is an ETA for a working Like feature? It would really be helpful.

Thanks,
Michael.

from facebook-android-sdk.

eldolor avatar eldolor commented on April 24, 2024

I have a couple of Android apps that can leverage the Like button. If you want, I can help you test and enhance the functionality, even if it is in an early development stage.

Please let me know.

from facebook-android-sdk.

EvgenyAndroid avatar EvgenyAndroid commented on April 24, 2024

That would be great, can we connect on - [email protected]
*
*
*-Evgeny
*
On 17 March 2011 08:41, eldolor <
[email protected]>wrote:

I have a couple of Android apps that can leverage the Like button. If you
want, I can help you test and enhance the functionality, even if it is in an
early development stage.

Please let me know.

Reply to this email directly or view it on GitHub:
#17 (comment)

from facebook-android-sdk.

aduran1700 avatar aduran1700 commented on April 24, 2024

Have you guys made any progress on the like button integration?

from facebook-android-sdk.

eldolor avatar eldolor commented on April 24, 2024

I have integrated the Facebook Like Button on my Android apps (Beer Cellar, Wine Cellar). I used a WebView to do so, as described by JohnWeidner. The only part that is tricky is managing the flow when a user is not logged in. I used the View.OnTouchListener to verify that fact, and to control the login process. It was relatively straightforward.

from facebook-android-sdk.

ir2pid avatar ir2pid commented on April 24, 2024

@eldolor could you elaborate how the flow was controlled and how you verified if a user isnt logged?

from facebook-android-sdk.

Born-in-Hell1988 avatar Born-in-Hell1988 commented on April 24, 2024

@bglod

Hello bgold,

when sso is implemented, Like button always authenticates the user to log in irrespective of whether we provide the access token or not. I am using the above code to implement the Like button.

Is this a bug? Is it documented ? Any workarounds?

This will be a terrible user experience if he has to Login to 'Like' each time.

Regards,

Sad Developer.

from facebook-android-sdk.

manitringapps avatar manitringapps commented on April 24, 2024

Any update on this? Still issue persists...

from facebook-android-sdk.

jamesgpearce avatar jamesgpearce commented on April 24, 2024

This issue was raised against an previous version of the Facebook SDK for Android.

In 2012, the SDK had a significant rewrite and relaunch, and we are closing issues and pull requests that predate that v3.0 release.

If you are still experiencing this issue, please raise a new issue with repro steps in the supported SDK (currently v3.6). For more information, please see our Android developer center at https://developers.facebook.com/docs/android.

Many thanks for using the Facebook Platform, and your support of this project.

from facebook-android-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.