I want to implement Facebook Connect in my android application. I have seen a few applications like foursquare which when you click Facebook Login it jumps to the Facebook app thats installed in the device and requests permission and once granted comes back to the application and logs you in.
I tried to implement the code from the following page
https://developers.facebook.com/docs/mobile/android/sso/
but when i click login a web view dialog pops up and as me to enter username and password.
Can any one refer me to some tutorial on SSO for Facebook Android SDK
public class SplashActivity extends Activity {
private Button loginButton, signupButton, FacebookButton;
public static final String APP_ID = "11232201730";
Facebook facebook = new Facebook("APP_ID");
String[] permissions = { "user_about_me", "email", "user_birthday",
"user_location", "publish_stream" };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
FacebookButton = (Button) findViewById(R.id.FacebookLogin);
FacebookButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
facebook.authorize(this, new Facebook.DialogListener() {
public void onFacebookError(FacebookError e) {
// TODO Auto-generated method stub
}
public void onError(DialogError e) {
// TODO Auto-generated method stub
}
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
}
public void onCancel() {
// TODO Auto-generated method stub
}
});
}
});
}
}
Error
The method authorize(Activity, Facebook.DialogListener) in the type Facebook is not applicable for the arguments (new View.OnClickListener(){}, new Facebook.DialogListener(){})
facebook.authorize(this, new Facebook.DialogListener()should be
facebook.authorize(SpashActivity.this, new Facebook.DialogListener()