使用Intent with scheme启动android应用程序

使用Intent with scheme启动android应用程序,android,android-intent,Android,Android Intent,我正在尝试获取一个web URL以打开/启动我的应用程序的活动,但它不起作用。URL类似于以下内容: “123123”&token=“absdi24” 我只需要将链接识别到“激活”点即可。我的意图如下: <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.c

我正在尝试获取一个web URL以打开/启动我的应用程序的活动,但它不起作用。URL类似于以下内容:

“123123”&token=“absdi24”

我只需要将链接识别到“激活”点即可。我的意图如下:

<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:scheme="https" android:host="zzz.yyy.com"
            android:path="/activate*"/>
        </intent-filter>


我在“路径”的末尾尝试了这段代码,有通配符(*)和没有通配符(*),但到目前为止没有任何效果。缺少什么?

android:path是一个文字完整的路径。试试
android:pathPrefix
android:pathPathPattern
——在这种情况下,
pathPrefix
似乎就足够了。

效果很好!非常感谢。现在,如果我想检索整个链接,因为令牌或帐户名是重要的信息,有没有办法获取传递到intent的链接?@ryanibinary:
getIntent().getData()
将为您提供与用于启动活动的
intent
关联的
Uri
。有一种可能,它会删除以
开头的内容——我知道您无法筛选查询参数,但我不确定它们是否仍保留在提供给您的
Uri
中。如果它们被剥离,您将需要考虑重写您的URL以更为Rest-Y(例如,<代码>)。https://zzz.yyy.com/user/123123123/activate/absdi24),这是正确的。如果它对其他任何人都有帮助,则使用来自数据URI的getQuery返回token=absdi24。再次感谢您的帮助!但愿我能投你一票again@RyanInBinary:啊,是的,我忘记了
getQuery()
——我很少看到它被使用,因为这是唯一与它相关的场景。