This is my code working fine.I am am getting invitaton. All of the code working .
Q)How to show log messages of callback.
Q) Why I can not get log messages in logcat.
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(AppURl)
.build();
AppInviteDialog appInviteDialog = new AppInviteDialog(getActivity());
appInviteDialog.registerCallback(sCallbackManager,
new FacebookCallback<AppInviteDialog.Result>() {
@Override
public void onSuccess(AppInviteDialog.Result result) {
Log.d("Invitation", "Invitation Sent Successfully");
Toast.makeText(getActivity(), "Invitation Sent Succseesfully", Toast.LENGTH_LONG).show();
}
@Override
public void onCancel() {
Log.d("Invitation", "Invitation Cancel Successfully");
}
@Override
public void onError(FacebookException e) {
Log.d("Invitation", "Error Occured");
}
});
appInviteDialog.show(content);
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
sCallbackManager.onActivityResult(requestCode, resultCode,data);
}
Note : I also register callback in OnActivitResutl.
Please Suggest Something If Question is Wrong. I am new on Stackoverflow.
Edit
When i use same code with Activity it works but when I use Fragment It does not work. Why any explanation or code error ?
Try to pass "FragmentName.this" instead of "getActivity" if you registering it from the fragment.
AppInviteDialog appInviteDialog = new AppInviteDialog(this);
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