Beside URL SCHEME, using the SDK based function is more simple.But it may not be the answer you want.
Remarks: The following information is based on facebook-android SDK 2.0(3.0 is avaliable now)
After running the authorize function (Login Part)(The following is sample code in facebook document)
facebook.authorize(this, new String[] {}, new DialogListener() {
@Override
public void onComplete(Bundle values) {
SharedPreferences.Editor editor = mPrefs.edit();
editor.putString("access_token", facebook.getAccessToken());
editor.putLong("access_expires", facebook.getAccessExpires());
editor.commit();
}
@Override
public void onFacebookError(FacebookError error) {}
@Override
public void onError(DialogError e) {}
@Override
public void onCancel() {}
});
}
In order to get the access token, just run the following function in SDK 2.0
String access_token=facebook.getAccessToken();
For the userID
public String GetUserID(){
Bundle params = new Bundle();
params.putString("fields", "id");
String resp= "";
try {
resp = facebook.request("me", params, "GET");//call the request function in SDK 2.0, using graph api
} catch (FileNotFoundException e) {
} catch (MalformedURLException e) {
} catch (IOException e) {
}
try{
resp = new JSONObject(resp).getString("id");
}catch(JSONException e1){
}
}
return resp;
};
I think these are the most simply way to get the result, but not using the URL SCHEME.
I hope it can help you.