Android, open url on my application

I have my own custom website where my Android app will receive data.

Lets call him example.com.

My Android app can transfer links through other apps like WhatsApp. When a link is shared, a type link is created http://example.com/my/path/to/information.

I want to open my application when this link is clicked. In my file, AndroidManifestI added these lines of code for my purposes:

<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="example.com" android:pathPattern="/.*" android:scheme="http"/>
</intent-filter>

My Activity processes its intent as follows:

Intent intent = getIntent();
Log.d("My_intent", intent.toString());
mainNewsId = intent.getStringExtra("news_info");
Log.d("News_result", mainNewsId);

When I use other applications in which the link is shared and click on it, she should offer me applications that can open this link.

, .

? meta - Android?

======================== UPDATE =================== ==============

. , android:host - , Android, , .. p >

, - -?

+4
2

, .

- link head:

<link rel="alternate" href="android-app://com.example.app/example.com/my/path/to/information"/>

:

<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="example.com" android:pathPattern="/.*" android:scheme="http"/>
   <data android:host="example.com" android:pathPattern="/.*" android:scheme="https"/>
   <data android:host="example.com" android:pathPattern="/.*" android:scheme="android-app"/>
   <data android:scheme="http"/>
</intent-filter>

. , , .

+1

. , http://example.com/my/path/to/information, :

<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="example.com" android:pathPattern="/my/" android:scheme="http"/>

, , .

0

Source: https://habr.com/ru/post/1607226/