How to stay connected to facebook in an Android app

I am working on an application where I need to integrate the social functions of Facebook.

There is a button in my application that connects the user to his Facebook profile. When the user clicks this button, I open the web view from the Facebook site using the Facebook user page. Now let me say that I know his email and password, and I want to connect it automatically so that he does not have to enter his email address and password every time. I tried to solve this by throwing the following question , but as you can see without success.

I also tried to store cookies with CookieSyncManager, CookieManager and manually.

I think I can solve this by changing the URL that I am posting to webView, but I do not know which URL. (try http://www.facebook.com/connect/connect_to_external_page_widget_loggedin.phpand http://www.facebook.com/plugins/login.phpthen connect the URL of the Facebook user page, for example http://www.facebook.com/UserProfile)

I really appreciate any help!

Thank.

+5
source share
3 answers

Here you can use SDK authentication instead of SSO, as described here: How to disable one-time Facebook for Android - Facebook-android-sdk . But I think that this simply leads to poor user experience, since the user will need to enter their email address / password, which is not of interest to most mobile devices.

facebook (katana) ( SSO), , .
, :
facebook

facebook Android
, - :

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.facebook.katana", "com.facebook.katana.ProfileTabHostActivity");
this.startActivity(intent);
+2

facebook. oAuth, , , AccessToken.

AccessToken .

, :

  • , onResume() , Android Android SDK / facebook. , 60 .

    public void onResume() {    
        super.onResume();
        facebook.extendAccessTokenIfNeeded(this, null);
    }
    
  • -

  • Facebook

    ! , .

, Facebook Android

+4

To connect to facebook, you first learn Oauth. Oauth is a one-time access check for facebook parts. A password is not required every time. Go through this documentation .

And this document is also useful for you.

0
source

All Articles