gpt4 book ai didi

Android 深层链接不起作用

转载 作者:行者123 更新时间:2023-12-01 07:43:06 34 4
gpt4 key购买 nike

Android deep linking is not working
===================================
Android link:-notification://id=notificationid

1:-在 list 中
      <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>

2:和编码方面
 @Override
protected void onResume() {
super.onResume();
Intent intent = getIntent();
String string=intent.getAction();
Uri data = intent.getData();
Log.d("hello","cgbdsuyfdkv");
}

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

最佳答案

你可以简单地修改你的网址

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.
  • list 代码
               <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>

  • 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);
    }

    关于Android 深层链接不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42555434/

    34 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com