Android 深层链接不起作用

Ash*_*ava 6 android

Android deep linking is not working
===================================
 Android link:-notification://id=notificationid
Run Code Online (Sandbox Code Playgroud)

1:-在清单中

      <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                    <category android:name="android.intent.category.BROWSABLE" />

                    <data
                        android:host="id"
                        android:scheme="notification" />
                </intent-filter>       
Run Code Online (Sandbox Code Playgroud)

2:-和编码端

 @Override
        protected void onResume() {
            super.onResume();        
            Intent intent = getIntent();
            String string=intent.getAction();
            Uri data = intent.getData();
            Log.d("hello","cgbdsuyfdkv");
        }   
Run Code Online (Sandbox Code Playgroud)

但它不起作用请任何人都可以帮助我!!!!!

Shi*_*mar 3

您只需修改您的网址即可

Android link:-notification://id=notificationid instead of
Android link:-notification://page?id=notificationid  //page is host name
I tried a lot and find out this is working for me.
Run Code Online (Sandbox Code Playgroud)
  1. 清单代码

               <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.BROWSABLE" />
    
                <data
                    android:host="page"
                    android:scheme="notification" />
            </intent-filter>       
    
    Run Code Online (Sandbox Code Playgroud)

2.java代码#在这里获取你的通知id

Intent intent = getIntent();
    String string = intent.getAction();
    Uri data = intent.getData();
    if (data != null) {
        String path = data.getPath();
        String path1 = data.getPath();
        providerUrl = intent.getData().toString();
        UrlQuerySanitizer sanitizer = new UrlQuerySanitizer();
        sanitizer.setAllowUnregisteredParamaters(true);
        sanitizer.parseUrl(providerUrl);
        String id = sanitizer.getValue("id");
        if (id != null)
            Log.d("notification id", id);
    }
Run Code Online (Sandbox Code Playgroud)