我对google文档感到困惑,同时处理普通的deepLinks和firebase动态链接。
为了处理普通的深度链接,我有这个:
File "/home/MyName/.local/lib/python3.5/site-packages/npyscreen/apNPSApplicationManaged.py", line 81, in switchForm
self._THISFORM.editing = False
AttributeError: 'MyApplication' object has no attribute '_THISFORM'
要添加对firebase动态链接(以及firebase app邀请)的支持,文档建议使用此功能:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
parseDeepLink(data);
}
但是,使用上面更新的代码,我无法接收普通的深度链接,因为pendingDynamicLinkData对于普通的深度链接始终为null。我应该在FirebaseDynamicLinks.getInstance()
.getDynamicLink(getIntent())
.addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
@Override
public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
if (pendingDynamicLinkData != null) {
Uri deepLink = pendingDynamicLinkData.getLink();
// Extract invite
FirebaseAppInvite invite = FirebaseAppInvite.getInvitation(pendingDynamicLinkData);
if (invite != null) {
String invitationId = invite.getInvitationId();
// handle invite
}
parseDeepLink(deepLink);
}
}
})
.addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
finish();
}
});
方法中使用parseDeepLink(getIntent().getData())
吗?
处理纯DeepLinks和Firebase动态链接的正确方法是什么?
答案 0 :(得分:2)
对于非动态链接,您应该使用
Uri data = intent.getData();
和以前一样。您可以在成功回调中检查,例如
if (pendingDynamicLinkData != null) {
Uri deepLink = pendingDynamicLinkData.getLink();
// Extract invite
FirebaseAppInvite invite = FirebaseAppInvite.getInvitation(pendingDynamicLinkData);
if (invite != null) {
String invitationId = invite.getInvitationId();
// handle invite
}
parseDeepLink(deepLink);
} else {
Uri data = intent.getData();
parseDeepLink(data);
}