firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
819 stars 424 forks source link

[Bug] DynamicLinks callback via TestFlight only works on fresh install #1265

Closed jonahgoldsaito closed 2 years ago

jonahgoldsaito commented 2 years ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

I have a dynamic link that points to TestFlight build (though it will point to the AppStore when we launch).

When the dynamic link is visited the first time, and the app is first installed through TestFlight, the msg: "[appname] pasted from Chrome" and most importantly, the DynamicLinks.DynamicLinkReceived delegate fires.

If I quit my app, return to Chrome, reload the same link, the app launches, but on this 2nd or any subsequent times,DynamicLinkReceived does not fire and the "pasted from Chrome" msg also doesn't come up.

Same behavior in Safari.

I assume it does work on subsequent loads through the App Store.

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Didn't try since it requires pushing to my TestFlight

What's the issue repro rate? (eg 100%, 1/5 etc) 100%

What happened? How can we make the problem occur?

  1. Push a build to Testflight
  2. Add TestFlight public link as destination of new dynamic URL (added manually via console)
  3. Follow link in browser
  4. Install app
  5. Launch app
  6. Quit
  7. Go back to browser and follow same link
  8. "OPEN" Testflight build again
  9. No event fired

If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.

Relevant Code:

Honestly there isn't any code beyond what is in the examples:

void Start()
{
      DynamicLinks.DynamicLinkReceived += OnDynamicLink;
}

void OnDynamicLink(object sender, EventArgs args)
{
      var dynamicLinkEventArgs = args as ReceivedDynamicLinkEventArgs;
      string[] ar = dynamicLinkEventArgs.ReceivedDynamicLink.Url.Segments;
      // do more things
}
paulinon commented 2 years ago

Hi @jonahgoldsaito,

Dynamic Links are designed to be opened by a "click" action as this minimizes the occurrence of issues when opening the link. The original link will not be preserved upon installing or switching to the application. This behavior is intended as Chrome does not support intent redirection, and the browser will only act as a proxy. It's possible that other browsers behave the same way as well.

I'll be closing this for now. Let me know if another issue arises.

jonahgoldsaito commented 2 years ago

Thanks @paulinon. I'm not sure if I communicated the issue well.

Imagine this scenario.

Someone who already has our app (downloaded via TestFlight) sees a postcard with a QR code that unlocks something in the app... Perhaps a new level in a game. The "unlocking" is by way of a special Dynamic Link. Of course there is the intermediary Google page with the clock action (which is annoying but I understand necessary).

Because they've already installed the app (and because it was done so via TestFlight), the QR code and dynamic Link don't fire the DynamicLinks.DynamicLinkReceived event, and subsequently the level isn't unlocked.

I'm assuming this would work in the official AppStore.

Clearly dynamic links should work to pass through the link information of the app is already installed, not just the first install. Right?

paulinon commented 2 years ago

Hi @jonahgoldsaito,

Based on the steps you've initially stated, it seems that you're pasting or accessing the link using a browser. Unlike that method, the scenario you recently described makes use of a "click" action, and the DynamicLinkReceived event is expected to be fired.

In the event that you encounter an issue after using a "click" action, let me know so we can identify what's causing this.