Skip to content

DynamicLink always open App Store even when App is installed #2145

@dejavu20180307

Description

@dejavu20180307

Issue

As described in the title, if I enter link in browser address and press enter, it will open app and pass url, trigger event. If I click open button on the preview, if always goes to app store.

I post details here, if anyone has answer, please help me!!
https://stackoverflow.com/questions/56231155/dynamic-link-always-open-app-store-regardless-of-app-installed-or-not


Project Files

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
target 'umr_app_ios' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for umr_app_ios
  pod 'Firebase/Core', '~> 5.20.1'
  pod 'Fabric', '~> 1.9.0'
  pod 'Crashlytics', '~> 3.12.0'
  pod 'Firebase/Auth', '~> 5.20.1'
  pod 'Firebase/Firestore', '~> 5.20.1'
  pod 'Firebase/AdMob', '~> 5.20.1'
  pod 'Firebase/Messaging', '~> 5.20.1'
  pod 'Firebase/RemoteConfig', '~> 5.20.1'
  pod 'Firebase/Performance', '~> 5.20.1'
  pod 'Firebase/DynamicLinks', '~> 5.20.1'


  target 'umr_app_iosTests' do
    inherit! :search_paths
    # Pods for testing
    pod 'Firebase/Core', '~> 5.20.1'
  end

end

target 'umr_app_ios-tvOS' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for umr_app_ios-tvOS

  target 'umr_app_ios-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

AppDelegate.m:

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
#import <Firebase.h>
#import "RNFirebaseNotifications.h"
#import "RNFirebaseMessaging.h"
#import "AppDelegate.h"
#import "RNFirebaseLinks.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#if __has_include(<React/RNSentry.h>)
#import <React/RNSentry.h> // This is used for versions of react >= 0.40
#else
#import "RNSentry.h" // This is used for versions of react < 0.40
#endif
#import <React/RCTLinkingManager.h>
@import GoogleMobileAds;
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

  [FIROptions defaultOptions].deepLinkURLScheme = @"com.umrgo.www.umr-app-ios";
  [FIRApp configure];
  [RNFirebaseNotifications configure];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"umr_app_ios"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  [RNSentry installWithRootView:rootView];

  rootView.backgroundColor = [UIColor blackColor];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [GADMobileAds configureWithApplicationID:@"ca-app-pub-2139002259612325~3595671175"];
  [self.window makeKeyAndVisible];
  return YES;
}

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
  [[RNFirebaseNotifications instance] didReceiveLocalNotification:notification];
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
                                                       fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
  [[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
  [[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
            options:(NSDictionary<NSString*, id> *)options
{
  BOOL handled = [[RNFirebaseLinks instance]
                  application:application
                  openURL:url
                  options:options
                  ] || [RCTLinkingManager
                        application:application
                        openURL:url
                        options:options
                        ];
  
  return handled;
}

- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray *))restorationHandler {
  BOOL handled = [[RNFirebaseLinks instance]
                  application:application
                  continueUserActivity:userActivity
                  restorationHandler:restorationHandler
                  ] || [RCTLinkingManager
                        application:application
                        continueUserActivity:userActivity
                        restorationHandler:restorationHandler
                        ];
  
  return handled;
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  BOOL handled = [RCTLinkingManager
                  application:application
                  openURL:url
                  sourceApplication:sourceApplication
                  annotation:annotation
                  ];
  return handled;
}

@end


Android

Click To Expand

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

  React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
      Memory: 27.53 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.10.1 - /usr/local/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.7.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    IDEs:
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3
      react-native: ^0.59.5 => 0.59.5
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N

I post details here, if anyone has answer, please help me!!
https://stackoverflow.com/questions/56231155/dynamic-link-always-open-app-store-regardless-of-app-installed-or-not

Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions