I am integrating Facebook LikeView in a fragment of Android App as defined in official fb docs.
LikeView like_button = (LikeView) findViewById(R.id.like_view);
like_button.setObjectId(...);
I've also handled onActivityResult like this:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
uiHelper.onActivityResult(requestCode, resultCode, data, null);
.....
}
I am unable to programmatically find if user have liked the page or unliked it from the LikeView. onActivityResults fires everytime the likeview's pop up returns but with no information about the result.
Please help me in identifying what am i missing. Any help will be greatly appreciated
You can get the user's actions by adding this code to your onActivityResults
:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
default:
if (resultCode == RESULT_OK) {
// verify we're returning from like action
if ("com.facebook.platform.action.request.LIKE_DIALOG".equals(data.getStringExtra("com.facebook.platform.protocol.PROTOCOL_ACTION"))) {
// get action results
Bundle bundle = data.getExtras().getBundle("com.facebook.platform.protocol.RESULT_ARGS");
if (bundle != null) {
bundle.getBoolean("object_is_liked"); // liked/unliked
bundle.getInt("didComplete");
bundle.getInt("like_count"); // object like count
bundle.getString("like_count_string");
bundle.getString("social_sentence");
bundle.getString("completionGesture"); // liked/cancel/unliked
}
}
}
break;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With