How to recognize firebase dynamic link before addSuccesListener?

时间:2017-12-18 05:34:43

标签: android firebase firebase-dynamic-links

In my application, many link handled in same Activity,

So, I need to know what link when link received.

I know that I will recognize after success listener,

FirebaseDynamicLinks.getInstance()
                .getDynamicLink(intent)
                .addOnSuccessListener(activity, new OnSuccessListener<PendingDynamicLinkData>() {
                    @Override
                    public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
                        if (pendingDynamicLinkData != null) {
                            Uri deepLink = pendingDynamicLinkData.getLink();

but, My app's UI thread have to know before success listener, because of UI thread's next operations.

So, I handle intent like that,

if(intent.getExtras() != null
            && intent.getExtras().toString().contains("firebase")) { // this comes from firebase dynamic links.

Could I handle intent in this way? And, Firebase framework will aways put extra data include firebase string?

Could you please, let me know any other solution? The bast ways, I hope to know my apps' host "(app).goo.gl" before success callback..

1 个答案:

答案 0 :(得分:0)

您可以检查intent extras是否包含特殊常量

getIntent().hasExtra("com.google.firebase.dynamiclinks.DYNAMIC_LINK_DATA")