gpt4 book ai didi

Android - url 方案不起作用,应用程序无法打开

转载 作者:太空狗 更新时间:2023-10-29 14:27:07 35 4
gpt4 key购买 nike

我想从自定义 URL 运行我的应用程序。我在 AndroidManifest 中添加了以下内容:

<activity android:name=".app.RunFromUrlActivity"
android:launchMode="singleInstance">
<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="myapp"/>
</intent-filter>
</activity>

但是,当我尝试转到 myapp://data 时,浏览器只是搜索该字符串而不是运行我的 Activity。

我做错了什么?

最佳答案

为“数据”尝试这样的事情:

<data
android:host="com.yourpackage.yourotherstuff.TheActivity"
android:scheme="yourscheme" />

这是适用于我的应用的一个:

<activity android:name=".BrowserActivity" >
<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="com.mypackage.otherstuff.BrowserActivity"
android:scheme="myapp" />
</intent-filter>
</activity>

这使我的 Activity 可以通过 myapp://com.mypackage.otherstuff.BrowserActivity 访问。

关于Android - url 方案不起作用,应用程序无法打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11216873/

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