0

I am working on React Native Project and I have a problem in deep linking Android. I have two different pathPrefix. Let say:

<data android:pathPrefix="/query" />

and

<data android:pathPrefix="/transaction" />

What I want are:

  1. If I click https://my.domain/query the native modal appears and give me an option to open it in app or browser
  2. But if i click https://my.domain/transaction its automatically direct me to my app without showing any modal

I have read this https://developer.android.com/training/app-links/verify-site-associations to solve number two and I already did. But didn't work like I want.

I already tried:

  1. Make two different activity. MainActivity and SecondActivity. in Main, i use prefix query and in SecondActivity, I use prefix transaction and in this activity, my intent-filter has android:autoVerify="true" to make the App Links works.
  2. I made one activity, but I have 2 inten-filter. One with android:autoVerify="true" and another one without it.

Both have the same result. It direct me to my app automatically.

My question, it is possible to have that different action? And if so, how to achieve it?

Thank you

1 Answers1

0

Have you tried with something like this?

<activity ...>

  <intent-filter android:autoVerify="false">
    <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"
      android:host="my.domain"
      android:pathPrefix="query" />
  </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"
      android:host="my.domain"
      android:pathPrefix="transaction" />

  </intent-filter>

</activity>
MatPag
  • 41,742
  • 14
  • 105
  • 114
  • what is tools:targetApi="m"? it makes my app error when installing process. it says: "The prefix "tools" for attribute "tools:targetApi" associated with an element type "intent-filter" is not bound." – Ryandhika Rukmana Jan 22 '21 at 11:41
  • You can remove it. It's a simple warning suppressor. If you want keep it you need to add this line `xmlns:tools="http://schemas.android.com/tools"` below `xmlns:android="http://schemas.android.com/apk/res/android"` like here: https://developer.android.com/studio/write/tool-attributes – MatPag Jan 22 '21 at 12:01