RomReed
@RomReed
JavaScript, Flutter, ReactNative, Redux, Firebase

React Native Firebase Deep Link не могу поймать url после установки?

Добрый день
Работаю с Dynamic Links. Если приложение установлено то после клика по ссылке оно прекрастно открывается и передаются параметы. Но я залил приложение в гугл стор и удалил приложение с телефона. После клика по ссылке приложение устанавливается но параметры уже не передаются. В чем может быть ошибка?
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/"}
    }
}
  • Вопрос задан
  • 532 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы