Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recognize firebase dynamic link before addSuccesListener?

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..

like image 373
심현용 Avatar asked Dec 18 '17 05:12

심현용


1 Answers

You can check if intent extras contains special constant

getIntent().hasExtra("com.google.firebase.dynamiclinks.DYNAMIC_LINK_DATA")
like image 110
Maxdestroyer Avatar answered Nov 15 '22 09:11

Maxdestroyer