Makalei Galkim
Makalei Galkim

Reputation: 25

Deeplinks in react native

I'm trying to implement an invite functionality where the user is able to create an invite link and other users when opening the link will be added to the friends list. It's an invite link that looks like this: https://myapp_domain/UNIQUE_CODE

The problem: I can't open the link on my own device(Android) despite that I can do it in the emulator with the command: adb shell am start -W -a android.intent.action.VIEW -d "http://dev.0xfire.com/ABC" . It redirects me in the browser and that's it. No redirect to the app at all. Same thing when I open the link inside the Android emulator, it redirects me to the browser. Just the command works as supposed to work

For this task people usually use Firebase Dynamic Links but it's going deprecated in August.

What I did:

  1. AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.socialapp">
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme">
    <activity android:name=".MainActivity" android:exported="true">
      <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
     <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https" />
        <data android:host="dev.0xfire.com"/>
    </intent-filter>
    </activity>
  </application>
</manifest>
  1. assetlinks.json

I created a route in my nodejs REST API /.well-known/assetlinks.json as written here https://dev.0xfire.com/.well-known/assetlinks.json. The SHA 256 certificate is generated with the key from the .android folder on my machine. I believe this can be the problem but don't know where to get the a trusted key for the certificate.https://developer.android.com/training/app-links/verify-android-applinks#web-assoc

Additional Information

I'm using Android 11 (R) in my emulator. The app isn't published. https://dev.0xfire.com/ is the invite domain and also the domain I access my REST API. The www is not configured for my domain.

Upvotes: 0

Views: 290

Answers (1)

I checked your assetlinks.json (https://dev.0xfire.com/.well-known/assetlinks.json), I found that your sha256_cert_fingerprints is not set. If you want to know your sha256_cert_fingerprints, you could place the keystore/jks file in the android/app folder then in the command line (same folder):

keytool -list -v -keystore *******.keystore

place the keystore's file name instead of *******

then the code will be shown to you in the Certificate fingerprints SHA256

Upvotes: 0

Related Questions