R
R
Roman Aleksandrovich2018-05-15 17:57:27
Android
Roman Aleksandrovich, 2018-05-15 17:57:27

React Native Firebase Deep Link can't catch url after install?

Good afternoon
I work with Dynamic Links. If the application is installed, then after clicking on the link it opens perfectly and the parameters are transferred. But I uploaded the app to google store and deleted the app from my phone. After clicking on the link, the application is installed, but the parameters are no longer transferred. What could be wrong?
url: https://rhx27.app.goo.gl/bCK1
full url: https://rhx27.app.goo.gl/?link=https://www.example...
Manifest

<application
        android:name=".MainApplication"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
            android:label="@string/app_name"
            android:launchMode="singleTop"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="your.dynamic.links.domain.example.com"
                    android:scheme="http" />
                <data
                    android:host="your.dynamic.links.domain.example.com"
                    android:scheme="https" />
                <data
                    android:host="https://rhx27.app.goo.gl"
                    android:scheme="http" />
                <data
                    android:host="https://rhx27.app.goo.gl"
                    android:scheme="https" />
                <data
                    android:host="www.example.com"
                    android:scheme="https" />
                <data
                    android:host="www.example.com"
                    android:scheme="http" />
                <data
                    android:host="my_deep_link"
                    android:scheme="app_code.app.goo.gl/?link=https" />
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

componentDidMount() {
         firebase.links()
            .getInitialLink()
            .then((url) => {
                if (url) {
                    Alert.alert(
                        'Alert Title getInitialLink',
                        url,
                        [
                            {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
                            {text: 'OK', onPress: () => console.log('OK Pressed')},
                        ],
                        {cancelable: false}
                    )

                } else {
                    // app NOT opened from a url
                }
            }).catch(e => Alert.alert('Alert Title error', e,
            [
                {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
                {text: 'OK', onPress: () => console.log('OK Pressed')},
            ],
            {cancelable: false}
        ))

        const unsubscribe = firebase.links().onLink((url) => {
            Alert.alert(
                'Alert Title onLink',
                url,
                [
                    {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
                    {text: 'OK', onPress: () => console.log('OK Pressed')},
                ],
                {cancelable: false}
            )
        })
    }

android {
    compileSdkVersion 23
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.specproj"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 21
        versionName "1.0.21"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
//            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
//            }
        }

    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // 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]
            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-firebase')) {
        transitive = false
    }

    implementation "com.facebook.react:react-native:+"  // From node_modules

    // Firebase dependencies
    implementation ("com.google.android.gms:play-services-base:15.0.0")
    implementation ("com.google.firebase:firebase-core:15.0.0")
    implementation ("com.google.firebase:firebase-invites:15.0.0")
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation ("com.android.support:appcompat-v7:23.0.1")
}

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.2.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        google()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url "https://maven.google.com/"}
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question