I've managed to connect my app and Facebook SDK and I can post photo to Album.
The thing is, I have "active image url" in my globals, and I use the following code to post it to Facebook:
Onclick...
case R.id.tab1_PublishFace:
Bundle params = new Bundle();
params.putString("method", "photos.upload");
Bitmap bi = BitmapFactory.decodeFile(Globals.INSTANCE.activeSetting.f_image_path);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);
imgData = baos.toByteArray();
params.putByteArray("picture", imgData);
Globals.INSTANCE.mAsyncRunner.request(null, params, "POST",new SampleUploadListener(), null);
break;
Now, what happens here is, my photo gets uploaded to default album (named as app is named), and it is not visible to anyone, even though I've manually changed in Facebook settings to be visible to some people. Beside that, my Images on facebook are not automatically placed to Album, but rather request that I approve them.
This is the code how I connect to Facebook and keep the token and session infos in SharedPreferences:
Globals.INSTANCE.facebook.authorize(getSherlockActivity(), new String[] {"publish_actions"}, new DialogListener() {
public void onFacebookError(FacebookError e) {
// TODO Auto-generated method stub
showToast("FacebookError");
}
public void onError(DialogError e) {
// TODO Auto-generated method stub
showToast("FacebookError");
}
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
ImageView img = (ImageView) getSherlockActivity().findViewById(R.id.imageView1);
TextView txt = (TextView) getSherlockActivity().findViewById(R.id.textView1);
txt.setText("Log Out from Facebook");
txt.setTag(faceLoggedIn);
showToast("Succesfully Loged To FB. Click Again to Logout");
SharedPreferences.Editor editor = mPrefs.edit();
editor.putString("access_token", Globals.INSTANCE.facebook.getAccessToken());
editor.putLong("access_expires", Globals.INSTANCE.facebook.getAccessExpires());
editor.commit();
}
public void onCancel() {
// TODO Auto-generated method stub
showToast("Canceled");
}
});
I'm looking at https://github.com/fbsamples/ios-android-wishlist example, and I don't see any special rights set up, and when I compile that example, my photos get published properly and no approval is needed.
What Am I missing, is it Facebook App settings, or something in my code?
I'd like images to be added to album, but to be published on my wall when posted.
Tnx