firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

DynamicLink consider only default FirebaseApp

Open tplkn opened this issue 4 years ago • 3 comments

Describe your environment

  • Android Studio version: Android Studio 4.2 Canary 16 Build #AI-202.7660.26.42.6939830, built on October 29, 2020
  • Firebase Component: Dynamic links
  • Component version: 19.1.1

Describe the problem

DynamicLink consider only the default firebase application, and it's not possible to use another instance of FirebaseApp

Steps to reproduce:

  • Init 2 FirebaseApp (for example "default" through config file google-services.json, and "secondary" through options)
  • Setup "secondary" firebase project with Dynamic links required settings (domain: ....page.link)
  • Try to create a short dynamic link with a "second" instance (code below) => Error: 400: Your project (<"default" firebase project id>) has not configured Dynamic Links.

Relevant Code:

 FirebaseDynamicLinks.getInstance(FirebaseApp.getInstance("secondary"))
   .createDynamicLink()
  .setDomainUriPrefix(<domain from "secondary" firebase project>)
  .setLink("https://example.com")
  .buildShortDynamicLink()
  .addOnSuccessListener {
      //
  ].addOnFailureListener {
    //
  }

Link to related code https://github.com/firebase/firebase-android-sdk/blob/master/firebase-dynamic-links/src/main/java/com/google/firebase/dynamiclinks/DynamicLink.java#L99

if (FirebaseApp.getInstance() != null) {
     builderParameters.putString(
            KEY_API_KEY, FirebaseApp.getInstance().getOptions().getApiKey());
}

tplkn avatar Nov 17 '20 12:11 tplkn

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Nov 17 '20 12:11 google-oss-bot

Internal bug number 174064658.

christibbs avatar Nov 23 '20 20:11 christibbs

Same issue.

  1. Should I have to enable the default firebase project for dynamic link ? Or Can just enable the second project for firebase dynamic link?
  2. Can I use the url prefix created in second project for native short link API? I had received this error=400: Your project does not own Dynamic Links domain

Any updates for this bug? Thanks.

aegis1530 avatar Jun 16 '22 04:06 aegis1530

Hi folks, we'd like to inform you that the Firebase Dynamic Links service will be shutdown on August 25, 2025. In the meantime, only critical or security issues will be fixed in the SDK.

More at https://firebase.google.com/support/dynamic-links-faq

argzdev avatar Sep 15 '23 15:09 argzdev