Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

react native - is it possible to have different action for every pathPrefix in deep linking android?

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

question from:https://stackoverflow.com/questions/65843470/is-it-possible-to-have-different-action-for-every-pathprefix-in-deep-linking-and

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...