vendredi 27 mars 2015

Facebook share result not returned

Inside my fragment I have an OnactiviyResult that contains:



uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() {
@Override
public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) {
Log.e("Activity", String.format("Error: %s", error.toString()));

}

@Override
public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) {
Log.d("Activity", "Success!");
boolean isComplete = FacebookDialog.getNativeDialogDidComplete(data);
String postId = FacebookDialog.getNativeDialogPostId(data);

if (isComplete) {
String completionGesture = FacebookDialog.getNativeDialogCompletionGesture(data);
if (completionGesture == null || FacebookDialog.COMPLETION_GESTURE_CANCEL.equals(completionGesture)) {
//Show Publish Cancel Toast
Toast.makeText(getActivity(), "User canceled facebook post", Toast.LENGTH_SHORT).show();


} else {
if (postId != null) {
Toast.makeText(getActivity(), "user published", Toast.LENGTH_SHORT).show();

try {
ParseObject game = new ParseObject("Deal");
game.put("User", user_ID);
game.save();
} catch (ParseException e) {
e.printStackTrace();
} finally {
Toast.makeText(getActivity(), "got" + user_ID, Toast.LENGTH_SHORT).show();
}


}
}
}
}
});


The problem that It never gets to it. nothing is returned. Calling it like that:



uiHelper.trackPendingDialogCall(shareDialogBuilder.build().present());


Now I found out that it is happening because of the fragment in this question: Facebook Intent share doesnt show Activity result on share click


He says "All I did was to export those codes into my MainActivity" How exactly It should look? Thanks


Aucun commentaire:

Enregistrer un commentaire