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 Fri, May 27, 2011 at 12:28 PM, Ali Chousein <[email protected]>wrote:
> I don't know what that parameters is about, but in general you need to
> create an application at the Facebook site and you get back a key.
> Using that key in your application is enough to start communicating
> with Facebook.
>
>
> On May 27, 12:35 am, bob <[email protected]> wrote:
> > Can someone help me what to put for the "FacebookApplicationSite"
> > parameter in the easy facebook android sdk library?
> >
> > Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en