Skip to content

[firebase_dynamic_link] v0.5.0 is not correctly working in ios in running/background state #1124

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

Closed
kroikie opened this issue Oct 13, 2019 · 7 comments
Labels
type: bug Something isn't working

Comments

@kroikie
Copy link
Collaborator

kroikie commented Oct 13, 2019

In android application firebase dynamic link 0.5.0 is working fine. But in ios device dynamic link is not working when app is in running/background state. But in killed state it works fine means when link is clicked in killed state it open correct location in the application.
I have no idea why it is happening.
should I use one of the old versions?

@kroikie
Copy link
Collaborator Author

kroikie commented Oct 13, 2019

@dhanrajvermaRepo

The issue at flutter/flutter#38744 has been closed and moved here. Future collaboration on this issue will be done here.

@logemann
Copy link

logemann commented Oct 22, 2019

Here are my findings on that issue.

FirebaseDynamicLinks.instance.getInitialLink() returns null in the following situations:

  • background state / app open
  • app closed before

It only works when app is in foreground mode.

All tests with the same DynamicLink and URL clicked from Notes app on iOS Xr real device. So from what i can gather, its totally unusable at this point.

Redirecting to AppStore works without problem if the app is not installed at all.

Tested with:

import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:logging_appenders/logging_appenders.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
    this.initDynamicLinks();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Welcome to Hello World'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Center(
              child: Text("Hello World")
            ),
          ],
        ),
      ),
    );
  }

   void initDynamicLinks() async {
    final PendingDynamicLinkData data =
        await FirebaseDynamicLinks.instance.getInitialLink();
    print("data $data");

    final Uri deepLink = data?.link;
    _logger.info("deeplink $deepLink");

    FirebaseDynamicLinks.instance.onLink(
        onSuccess: (PendingDynamicLinkData dynamicLink) async {
      final Uri deepLink = dynamicLink?.link;

      _logger.info("onLink $deepLink");
      if (deepLink != null) {
        print("onLink Path ${deepLink.path}");
      }
    }, onError: (OnLinkErrorException e) async {
      print("onLink error ${e.message}");
    });
  }
}

used firebase_dynamic_links: ^0.5.0+1

together with: Flutter (Channel dev, v1.10.14, on Mac OS X 10.15 19A583, locale de-DE)

@wilburx9
Copy link

To buttress @logemann's findings, it always works on iOS when the app is in the foreground mode. However, it works for me in background mode, but it appears to be random and inconsistent.

@iapicca iapicca changed the title firebase_dynamic_link 0.5.0 is not correctly working in ios device when application is in running/background state. [firebase_dynamic_link] v0.5.0 is not correctly working in ios in running/background state Nov 5, 2019
@iapicca
Copy link

iapicca commented Nov 5, 2019

#1041

@MderM
Copy link

MderM commented Nov 9, 2019

I got the same behaviour with 0.4.0+6, also.

@MderM
Copy link

MderM commented Nov 9, 2019

Nevermind. Got it working just like it should. All having this same issue, please follow the setup guide on the flutter pub site.

Receiving dynamic links on iOS requires a couple more steps than Android. If you only want to receive dynamic links on Android, skip to step 4. You can also follow a video on the next two steps here.

In the Info tab of your iOS app's Xcode project:
Create a new URL Type to be used for Dynamic Links.
Set the Identifier field to a unique value and the URL Schemes field to be your bundle identifier, which is the default URL scheme used by Dynamic Links.
In the Capabilities tab of your app's Xcode project, enable Associated Domains and add the following to the Associated Domains list:
applinks:YOUR_SUBDOMAIN.page.link

@kroikie
Copy link
Collaborator Author

kroikie commented Nov 11, 2019

Seems like in general this issue is resolved. For more specific cases where there are issues with the plugin please file an issue.

@kroikie kroikie closed this as completed Nov 11, 2019
@firebase firebase locked and limited conversation to collaborators Aug 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants