我正在尝试使用Firebase在我的Android应用中实施App Invite系统。代码与guide中的代码完全相同。
private void onInviteClicked() {
Intent intent = new AppInviteInvitation.IntentBuilder("Title here")
.setMessage("message here")
.setDeepLink(Uri.parse("deep_link_here")
.setCallToActionText("Install!"))
.build();
startActivityForResult(intent, REQUEST_INVITE);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.d(TAG, "onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode);
if (requestCode == REQUEST_INVITE) {
if (resultCode == RESULT_OK) {
// Get the invitation IDs of all sent messages
String[] ids = AppInviteInvitation.getInvitationIds(resultCode, data);
for (String id : ids) {
Log.d(TAG, "onActivityResult: sent invitation " + id);
}
} else {
// Sending failed or it was canceled, show failure message to the user
// ...
Toast.makeText(getContext(), "Invite not sent!", Toast.LENGTH_SHORT).show();
}
}
}
我的问题是:
resultCode
0并且ids
为空。resultCode
再次为0。答案 0 :(得分:0)