gpt4 book ai didi

java - Duckduckgo Android 搜索 Intent

转载 作者:行者123 更新时间:2023-11-30 10:15:19 25 4
gpt4 key购买 nike

有人知道直接通过 Android 上的官方 Duckduckgo 应用程序进行搜索的 Intent 吗?

Tried this one so far, i think they dont have a query key in extras

    Intent intent = new Intent(Intent.ACTION_SEARCH);
intent.setPackage("com.duckduckgo.mobile.android");
intent.putExtra("query", subject);
context.startActivity(intent);

最佳答案

It is actually pretty simple than i thought

    Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://duckduckgo.com/?q=" + subject));

try {
intent.setPackage("com.duckduckgo.mobile.android");
context.startActivity(intent);
} catch (ActivityNotFoundException a) {
intent.setPackage(null);
context.startActivity(intent);
}

关于java - Duckduckgo Android 搜索 Intent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50482540/

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