Following points to keep in mind :-

   - Create an application on developers.facebook.com
   - In settings make it accessible for Mobile
   - You will get app id save it
   - download the facebook for android sdk
   - create a new android application in your IDE
   - copy paste the package com.facebook.android
   - refresh your project by right clicking in project explorer and now you
   can see the facebook package in your project
   - implement your activity with DialogListenrer
   - you will be asked to add unimplemented methods just do as they say
   - create a new Facebook variable like Facebook facebook = new
   Facebook(APP_ID)
   - Create another method and write this peice of code in it ->
*facebook.authorize(this, new String[]{ "publish_stream",
                   "read_stream", "offline_access" }, 0, this);*
   - The above line of code is necessary for letting the user authorize the
   facebook application and you have to choose the authorize method which
   accepts 4 constructors <I spend hours to get it working for SSO>
   - Now in your oncreate method call the above created method and thats it
   :)

Following is the code :-

public class myFacebook extends Activity implements DialogListener{
    /** Called when the activity is first created. */
     Facebook facebook = new Facebook(YOUR_APP_ID);

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(
savedInstanceState);
        setContentView(R.layout.main);
        ImageView iv = (ImageView)findViewById(R.id.img);

        onfbLogin();                  *Calling the method*
    }

    public void onActivityResult(int requestCode, int resultCode, Intent
data) {
        super.onActivityResult(requestCode, resultCode, data);

        facebook.authorizeCallback(requestCode, resultCode, data);
    }

    @Override
    public void onCancel() {
        // TODO Auto-generated method stub

    }

    @Override
    public void onComplete(Bundle values) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onError(DialogError e) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onFacebookError(FacebookError e) {
        // TODO Auto-generated method stub

    }

    public void onfbLogin(){
        facebook.authorize(this, new String[]{ "publish_stream",
// *Necessary peice of code for SSO*
                "read_stream", "offline_access" }, 0, this);


On Mon, May 30, 2011 at 12:34 PM, Ali Chousein <ali.chous...@gmail.com>wrote:

> What???  The official Facebook app has nothing to do with the app you
> develop, which integrates Facebook API. Of course you need to retrieve
> your app secret from Facebook and put it in the code of your
> application. The official Facebook app and your app are two completely
> different things.
>
> And Bob, if you are not sure whether you should use the API key or the
> app secret, try both and see which one works. It won't take you more
> than 5 mins.
>
>
> On May 30, 6:31 am, warenix <ware...@gmail.com> wrote:
> > no, you don't need to put app secret.
> >
> > authorization of your app will be done by "official" app installed.
> > a pop up browser window will be shown.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to