gpt4 book ai didi

android - 无法让我的应用程序出现在选择器中 Android BROWSABLE

转载 作者:行者123 更新时间:2023-11-30 02:22:49 26 4
gpt4 key购买 nike

我正在上 Android 类(class),我们有一个任务,其中之一是制作一个名为“MyBrowser”的程序,如果另一个程序发送隐式 Intent ,他们会提供给我们,以便能够出现在选择器中,我研究并发现了这一点:

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

<intent-filter>
<action android:name="andoid.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
</intent-filter>

第一个 Intent 过滤器已经在文件中,我添加了第二个,但它不起作用,我真的不明白为什么,隐式 Intent 是这样的:

private void startImplicitActivation() {

Uri webpage = Uri.parse("http://www.google.com");
Intent baseIntent = new Intent (Intent.ACTION_VIEW, webpage);

Intent chooserIntent = Intent.createChooser(baseIntent, "Choose application");

startActivity(chooserIntent);
}

这是我尝试打开的唯一 Intent 。

提前致谢。

最佳答案

好的,我决定从 Android 浏览器复制粘贴 Intent 过滤器,它起作用了,后来我开始删除随机的 组 ... 直到它停止工作并被留下有了这个,现在它可以工作了:

<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="http" />

</intent-filter>

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

关于android - 无法让我的应用程序出现在选择器中 Android BROWSABLE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28258258/

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