Ya the breif summary about the facebook connection and SSO is
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);
Plus u need to get the hash key of your android application keystore which
you will place in your
facebook application settings under android
On Tue, Jun 7, 2011 at 9:45 AM, Sourav Howlader
<[email protected]>wrote:
> Hi Goutom,
>
> Check this link.
> http://developers.facebook.com/docs/guides/mobile/#android
>
> Regards,
> Sourav
>
> --
> 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
--
Regards
Abhishek Talwar
9953395712
--
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