In Firebase Dynamic linking via Fcm, it just opens the app rather than going to activity

Viewed 519

In Firebase Dynamic linking via Fcm the link directs me to activity only when the app is open if closed and I click on the notification; it just opens the app

      <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <data android:host="www.example.com" android:path="/book" android:scheme="http"/>
            <data android:host="www.example.com" android:path="/book" android:scheme="https"/>
        </intent-filter>

BooksActivity.java

FirebaseDynamicLinks.getInstance()
            .getDynamicLink(getIntent())
            .addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
                @Override
                public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
                    Uri deepLink = null;
                    if (pendingDynamicLinkData != null) {
                        deepLink = pendingDynamicLinkData.getLink();
                       //Getting the id from notification dynamic linking
                        bookId= MyFirebaseMessagingService.BOOK_ITEM_ID;
                    }
                    if (deepLink != null) {
                        Snackbar.make(findViewById(android.R.id.content),
                                "Found deep link!", Snackbar.LENGTH_LONG).show();

                    } else {
                        Log.d(TAG, "getDynamicLink: no link found");
                    }
                }

            })
            .addOnFailureListener(this, new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    Log.w(TAG, "getDynamicLink:onFailure", e);
                }
            });

//Thanks in advance

0 Answers
Related