Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase_dynamic_links] plugin is not working in ios when app is in Back ground. #33

Closed
dhanrajvermaRepo opened this issue Aug 26, 2019 · 20 comments · Fixed by #4354
Closed
Labels
plugin: dynamic_links type: bug Something isn't working type: documentation Improvements or additions to documentation

Comments

@dhanrajvermaRepo
Copy link

I have downloaded the example app from https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_dynamic_links/example.
This example is running fine on android but on ios it is doing nothing when app is in background.
In fact onLink method was never called when ios app is in background.
HELP me please.

@collinjackson collinjackson changed the title firebase dynamic links plugin is not working in ios when app is in Back ground. [firebase_dynamic_links] plugin is not working in ios when app is in Back ground. Aug 26, 2019
@jherencia
Copy link
Contributor

jherencia commented Aug 27, 2019

I'm going to try to check this this week.

EDIT: Finally I will be able to check this next week: September 23-29

@jherencia
Copy link
Contributor

jherencia commented Oct 3, 2019

I've pushed a PR with the fix, can you try? You just need to point to the PR version?

  firebase_dynamic_links:
    git:
      url: https://github.com/mrmilu/flutterfire.git
      path: packages/firebase_dynamic_links
      ref: firebase_dynamic_links-0.5.0+4

@quetool
Copy link

quetool commented Oct 3, 2019

I've pushed a PR with the fix, can you try? You just need to point to the PR version?

  firebase_dynamic_links:
    git:
      url: https://github.com/mrmilu/flutterfire.git
      path: packages/firebase_dynamic_links
      ref: firebase_dynamic_links-0.5.0+4

I don't know what @dhanrajvermaRepo means with "when app is in background" because, in order to open a Dynamic link from somewhere else, your app needs to be in background for sure, so...
Anyway, it is not working at all on iOS. App is being called and opened just fine, but the listener is not being called...
And not, @jherencia, your fix is not working, at leas not for me...
So I opened another issue #262

@jherencia
Copy link
Contributor

@quetool
As you pointed in the other issue (#262) you are using a custom domain, and when you configured correctly the Info.plist file, everything worked.

Does that mean that the my PR worked for you?

@quetool
Copy link

quetool commented Oct 4, 2019

@jherencia sorry, I didn't notice you were talking about default domains... I didn't try again your PR after I solved my issue like I said in in #262
So, we need to wait for @dhanrajvermaRepo to answer that...

@jherencia
Copy link
Contributor

@quetool

So you were using the latest official version (0.5.0+3) not the PR when it worked, right?

@quetool
Copy link

quetool commented Oct 4, 2019

That's right

@HofmannZ
Copy link

HofmannZ commented Oct 5, 2019

Managed to get it working, though it's still subscribing to onLink multiple times, because I can't dispose the listener upon unmount. Would be good to get the listener back from channel.

Also note that

Navigator.pushNamed(context, deepLink.path);

needs to be a child of MaterialApp to work.

@dhanrajvermaRepo
Copy link
Author

I've pushed a PR with the fix, can you try? You just need to point to the PR version?

  firebase_dynamic_links:
    git:
      url: https://github.com/mrmilu/flutterfire.git
      path: packages/firebase_dynamic_links
      ref: firebase_dynamic_links-0.5.0+4

I'll test my App on 8 October and let you know whether it is working or not.
Thank you

@dhanrajvermaRepo
Copy link
Author

dhanrajvermaRepo commented Oct 7, 2019

I've pushed a PR with the fix, can you try? You just need to point to the PR version?

  firebase_dynamic_links:
    git:
      url: https://github.com/mrmilu/flutterfire.git
      path: packages/firebase_dynamic_links
      ref: firebase_dynamic_links-0.5.0+4

Hi, I have tested my app with this PR. It is working when app is in background. When app is in killed state it navigates to appropriate screen but returns to my root widget within a micro/millisecond. It is so fast that it seems it directly opens my root widget (root screen ie login screen). I have is used toast to debug this issue as in killed state i can not debug it.
Android working fine in all cases.

@jherencia
Copy link
Contributor

Can you post some example code to reproduce this?

@dhanrajvermaRepo
Copy link
Author

dhanrajvermaRepo commented Oct 9, 2019

Can you post some example code to reproduce this?

I am sorry.
PR is working fine in both android and iOS. There was a bug in my code.
Thank you very much.

@jherencia
Copy link
Contributor

Great to hear, thank you!

@dhanrajvermaRepo
Copy link
Author

dhanrajvermaRepo commented Oct 9, 2019

Great to hear, thank you!

But one thing i forgot to mention is that in every state(Active/background, killed) onLink method's onSuccess callback is called on iOS. But in android on Active/background state onLink method's onSuccess is called and in killed state getInitial link returns deepLink.
May I release my App with this PR?

@quetool
Copy link

quetool commented Oct 9, 2019

@jherencia I can confirm your PR fix the problem on iOS when app is in "killed state"

@dhanrajvermaRepo
Copy link
Author

Great to hear, thank you!

why onError callback of onLink method is not called when we do not come by link in iOS?
getInitialLink always returns null in iOS.

@jherencia
Copy link
Contributor

Because is not an error.

onError is called when we clicked on a dynamic link and something fails (for example, a network call to Firebase API to resolve the short link)

@dhanrajvermaRepo
Copy link
Author

@jherencia Can I release my App with this PR?

@jherencia
Copy link
Contributor

jherencia commented Oct 10, 2019

Well, I cannot guarantee anything about this, it's a PR which has to pass a review and a process which can end up in the repo or not.

I wouldn't trust my repo because I can change things in the future without notice.

It's your call to clone it and freeze the version so you can rely on your own repo or wait or whatever you think is the best for your project.

@Ehesp
Copy link
Member

Ehesp commented Apr 21, 2020

Closing - looks like the problem is now fixed. Please create a new issue if the problem still persists as this one has generated a lot of noise from users posting stack traces without formatting.

@Ehesp Ehesp closed this as completed Apr 21, 2020
@firebase firebase locked and limited conversation to collaborators Aug 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: dynamic_links type: bug Something isn't working type: documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants