Closed jamesawer3 closed 4 years ago
You didn't mention what version of react-native-firebase you are on
but...maybe auto-verify=true? https://firebase.google.com/docs/dynamic-links/android/receive#record-analytics
https://firebase.google.com/docs/dynamic-links/android/receive#handle_deep_links
I am still learning dynamic links, so this is a medium probability answer - looks like it's definitely missing, but may not solve your problem
My react-native-firebase
version is 5.5.6
ok - that's the version I am on, so at minimum I have experience there and am currently implementing links myself, so I'm motivated - sounds silly perhaps but that's important.
I'm also seeing a lot of this: set launchMode of MainActivity to singleTask in order to receive intent on existing MainActivity. It is useful if you want to perform navigation using deep link you have been registered - details
- I don't recall seeing any launchMode in your AndroidManifest
This appears to have some nice guides for testing and is where the quote above came from, but the 'singleTask' mention was in other locations as well https://reactnavigation.org/docs/en/deep-linking.html
In my case how to set launchMode to singleTask in MainActivity??? I have set like this but I'm getting the same problem
<application
android:name=".MainApplication"
android:allowBackup="false"
android:exported="true"
android:largeHeap="true"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:launchMode="singleTask"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
And changed intent-filter link this
<intent-filter android:autoVerify="true">
<action android:name="com.google.firebase.MESSAGING_EVENT" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host=".dynamic.link" android:scheme="http" />
<data android:host=".dynamic.link" android:scheme="https" />
</intent-filter>
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
Issue
I'm trying to open a dynamic link in android app when my app is in closed state that is not in background and active state
Project Files
Android
Click To Expand
#### `android/build.gradle`: ``` // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = "28.0.0" } repositories { google() jcenter() mavenCentral() maven { url "https://jitpack.io" } maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.google.gms:google-services:4.2.0' classpath 'com.google.firebase:firebase-plugins:1.2.0' classpath 'io.fabric.tools:gradle:1.26.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() mavenLocal() jcenter() maven { url "https://maven.google.com" } maven { url "https://jitpack.io" } maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } } } subprojects { afterEvaluate {project -> if (project.hasProperty("android")) { android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion } } } } ``` #### `android/app/build.gradle`: ``` project.ext.envConfigFiles = [ devdebug:".env.dev", devrelease:".env.dev", preprodrelease : ".env.preprod", prodrelease:".env.prod", ] apply plugin: "com.android.application" apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" apply plugin: 'io.fabric' import com.android.build.OutputFile project.ext.react = [ entryFile: "index.js", bundleAssetName: "index.android.bundle", bundleInDebug: false, bundleInDevDebug: false, bundleInRelease: true, bundleInDevRelease: true, bundleInPreprodRelease: true, bundleInProdRelease: true, devDisabledInDevRelease: true, devDisabledInPreprodRelease: true, devDisabledInProdRelease: true, root: "../../" ] apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" apply from: "../../node_modules/react-native/react.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = true android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion flavorDimensions "default" dexOptions { javaMaxHeapSize "4G" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { applicationId "com.xcz.avb" resValue "string", "build_config_package", "com.xcz.avb" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode project.env.get("APP_VERSION_CODE").toInteger() versionName project.env.get("APP_VERSION_NAME") multiDexEnabled true } signingConfigs { devRelease { storeFile file(DEV_STORE_FILE) storePassword DEV_STORE_PASSWORD keyAlias DEV_KEY_ALIAS keyPassword DEV_KEY_PASSWORD } preProdRelease { storeFile file(PREPROD_STORE_FILE) storePassword PREPROD_STORE_PASSWORD keyAlias PREPROD_KEY_ALIAS keyPassword PREPROD_KEY_PASSWORD } prodRelease { storeFile file(PROD_STORE_FILE) storePassword PROD_STORE_PASSWORD keyAlias PROD_KEY_ALIAS keyPassword PROD_KEY_PASSWORD } } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } productFlavors { dev { dimension "default" applicationIdSuffix project.env.get("APP_ID_SUFFIX") productFlavors.dev.signingConfig signingConfigs.devRelease } preprod { dimension "default" applicationIdSuffix project.env.get("APP_ID_SUFFIX") productFlavors.preprod.signingConfig signingConfigs.preProdRelease } prod { dimension "default" applicationIdSuffix project.env.get("APP_ID_SUFFIX") productFlavors.prod.signingConfig signingConfigs.prodRelease } } buildTypes { debug { debuggable true minifyEnabled false proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } release { debuggable false minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { implementation project(':react-native-reanimated') implementation project(':react-native-config') implementation project(':react-native-webview') implementation 'com.facebook.android:facebook-android-sdk:[5,6)' implementation project(':react-native-fbsdk') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation project(':react-native-firebase') implementation project(':react-native-vector-icons') implementation project(':react-native-gesture-handler') implementation project(':react-native-contacts') implementation project(':react-native-linear-gradient') implementation project(':react-native-spinkit') implementation project(':react-native-image-picker') implementation project(':react-native-document-picker') implementation project(':rn-fetch-blob') implementation project(':react-native-community-netinfo') implementation project(':react-native-device-info') implementation project(':@react-native-community_async-storage') implementation project(':react-native-splashscreen') //noinspection GradleCompatible implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.facebook.react:react-native:+" implementation "com.google.android.gms:play-services-base:16.1.0" implementation "com.google.firebase:firebase-core:16.0.8" implementation "com.google.firebase:firebase-auth:16.2.1" implementation "com.google.firebase:firebase-crash:11.8.0" implementation 'com.facebook.fresco:animated-gif:0.11.0' implementation "com.google.firebase:firebase-firestore:18.2.0" implementation "com.google.firebase:firebase-functions:16.3.0" implementation "com.google.firebase:firebase-messaging:17.5.0" implementation 'me.leolin:ShortcutBadger:1.1.21@aar' implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') { transitive = true } implementation "com.google.firebase:firebase-invites:17.0.0" implementation "com.google.firebase:firebase-config:16.5.0" } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply plugin: 'com.google.gms.google-services' ``` #### `android/settings.gradle`: ``` rootProject.name = 'bublenet' include ':react-native-reanimated' project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android') include ':react-native-config' project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android') include ':react-native-webview' project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android') include ':react-native-fbsdk' project(':react-native-fbsdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fbsdk/android') include ':react-native-firebase' project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':react-native-gesture-handler' project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android') include ':react-native-contacts' project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-contacts/android') include ':react-native-linear-gradient' project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android') include ':react-native-spinkit' project(':react-native-spinkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spinkit/android') include ':react-native-image-picker' project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android') include ':rn-fetch-blob' project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android') include ':react-native-document-picker' project(':react-native-document-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-picker/android') include ':react-native-community-netinfo' project(':react-native-community-netinfo').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/netinfo/android') include ':react-native-device-info' project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android') include ':@react-native-community_async-storage' project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android') include ':react-native-splashscreen' project(':react-native-splashscreen').projectDir = new File(settingsDir, '../node_modules/@remobile/react-native-splashscreen/android') include ':app' ``` #### `MainApplication.java`: ```j package com.xcz.avb; import android.app.Application; import com.facebook.CallbackManager; import com.facebook.react.ReactApplication; import com.swmansion.reanimated.ReanimatedPackage; import com.lugg.ReactNativeConfig.ReactNativeConfigPackage; import com.reactnativecommunity.netinfo.NetInfoPackage; import com.reactnativecommunity.webview.RNCWebViewPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.reactnative.androidsdk.FBSDKPackage; import com.facebook.soloader.SoLoader; import com.oblador.vectoricons.VectorIconsPackage; import com.rt2zz.reactnativecontacts.ReactNativeContacts; import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; import java.util.Arrays; import java.util.List; import com.react.rnspinkit.RNSpinkitPackage; import io.invertase.firebase.RNFirebasePackage; import com.BV.LinearGradient.LinearGradientPackage; import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage; import io.invertase.firebase.auth.RNFirebaseAuthPackage; import io.invertase.firebase.config.RNFirebaseRemoteConfigPackage; import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage; import io.invertase.firebase.firestore.RNFirebaseFirestorePackage; import io.invertase.firebase.functions.RNFirebaseFunctionsPackage; import io.invertase.firebase.messaging.RNFirebaseMessagingPackage; import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage; import com.imagepicker.ImagePickerPackage; import com.reactnativedocumentpicker.ReactNativeDocumentPicker; import com.RNFetchBlob.RNFetchBlobPackage; import com.learnium.RNDeviceInfo.RNDeviceInfo; import com.reactnativecommunity.asyncstorage.AsyncStoragePackage; import com.crashlytics.android.Crashlytics; import io.fabric.sdk.android.Fabric; import io.invertase.firebase.links.RNFirebaseLinksPackage; import com.remobile.splashscreen.RCTSplashScreenPackage; import com.facebook.FacebookSdk; import com.facebook.appevents.AppEventsLogger; public class MainApplication extends Application implements ReactApplication { private static CallbackManager mCallbackManager = CallbackManager.Factory.create(); protected static CallbackManager getCallbackManager() { return mCallbackManager; } private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List getPackages() {
return Arrays.asList(new MainReactPackage(), new ReanimatedPackage(),
new ReactNativeConfigPackage(), new NetInfoPackage(), new RNCWebViewPackage(),
new RCTSplashScreenPackage(MainActivity.activity, true), new RNSpinkitPackage(),
new RNFirebasePackage(), new LinearGradientPackage(), new RNFirebaseNotificationsPackage(),
new RNFirebaseAuthPackage(), new RNFirebaseFirestorePackage(), new VectorIconsPackage(),
new RNGestureHandlerPackage(), new RNFirebaseFunctionsPackage(), new RNFirebaseAnalyticsPackage(),
new RNFirebaseRemoteConfigPackage(), new RNFirebaseMessagingPackage(),
new RNFirebaseCrashlyticsPackage(), new RNFirebaseLinksPackage(), new ReactNativeContacts(),
new FBSDKPackage(mCallbackManager), new ImagePickerPackage(), new ReactNativeDocumentPicker(),
new RNDeviceInfo(), new RNFetchBlobPackage(), new AsyncStoragePackage());
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
Fabric.with(this, new Crashlytics());
SoLoader.init(this, /* native exopackage */ false);
}
}
```
#### `AndroidManifest.xml`:
```
```
Environment
Click To Expand
**`react-native info` output:** ``` info React Native Environment Info: System: OS: macOS 10.14.6 CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz Memory: 4.73 GB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 12.4.0 - /usr/local/bin/node npm: 6.9.2 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0 IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 11.0/11A420a - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.5 => 0.59.5 npmGlobalPackages: react-native-cli: 2.0.1 ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [x] 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. Dynamic Links` - **Are you using `TypeScript`?** - `N`
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]React Native Firebase
andInvertase
on Twitter for updates on the library.