我在我的应用程序中实现了Facebook App Invites功能。发送和接收在我的应用中运行良好,但在其Android应用上收到邀请的Facebook用户既没有收到指定here的推送通知或一般通知。它仅显示在App Invites部分中。 有谁知道我可以做些什么才能显示Facebook通知?
Facebook SDK 4.20
邀请发送
private void initFbInvite(final CallbackManager callbackManager, final View inviteButton){
Map<AppLinksManager.QueriesKeys, String> queries = new HashMap<>();
queries.put(AppLinksManager.QueriesKeys.SENDER, UserManager.getInstance().getUser().getId());
final Uri appLink = AppLinksManager.generateAppLink(AppLinksManager.Endpoint.FB_INVITE, queries);
StorageReference previewImageUrlRef = mController.getStorageReference().child("applink-images/fb-invite.png");
previewImageUrlRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
final AppInviteContent inviteContent = new AppInviteContent.Builder()
.setApplinkUrl(appLink.toString())
.setPreviewImageUrl(uri.toString())
.build();
final AppInviteDialog appInviteDialog = new AppInviteDialog(ExploreFragment.this);
appInviteDialog.registerCallback(callbackManager, new FacebookCallback<AppInviteDialog.Result>() {
@Override
public void onSuccess(AppInviteDialog.Result result) {
Log.d(TAG, "FB invitation send successfully");
}
@Override
public void onCancel() {
Log.e(TAG, "FB invitation cancelled");
}
@Override
public void onError(FacebookException error) {
Log.e(TAG, "FB invitation error");
}
});
inviteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
appInviteDialog.show(inviteContent);
}
});
}
});
}
用于此AppInviteContent的自定义应用链接网址
https://stellarscepter.com/clecs/fb-invite?sender=PsF6qaJPLKVnOjxr2Ufzs5cSVTZ2
用于App Link元数据的index.html(存储在服务器上的clecs / fb-invite文件夹中)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Facebook App Link meta -->
<meta property="al:android:url" content="clecs://fb-invite" />
<meta property="al:android:app_name" content="Clecs" />
<meta property="al:android:package" content="com.stellarscepter.clecs" />
<meta property="al:android:class" content="com.stellarscepter.clecs.activity.LoginActivity" />
<meta property="al:web:should_fallback" content="false" />
<title>Stellarscepter</title>
</head>
<body>
</body>
</html>
编辑1:
我试过测试和真正的Facebook用户,已经收到邀请但没有收到任何人。我还尝试过已经自动化的用户,而不是通过Facebook自动化。在每个组合中都没有显示Facebook通知。