【发布时间】:2020-10-18 22:37:32
【问题描述】:
上下文:我正在开发一个高效的开源 android 启动器 (view on GitHub)。在其settings-activity 中有一个标记为Install apps 的按钮,它应该将用户带到他选择的商店(F-Droid 或 PlayStore)。
目前,该按钮只能打开 PlayStore。这是相应的代码(最小的可重现示例):
// in the install buttons on-click listener:
val storeIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/")
)
startActivity(storeIntent) // go to the store
StackOverflow 上的其他帖子向我展示了使用 market:// URI (from this answer) 来使用意图打开任何商店(并自动让用户决定他们想去哪个商店)。这是功能性的(并在其他地方用于应用程序)但在这里不是很有帮助,因为我们要打开商店主页/起始页面。
普通的market:// URI 不会选择要打开的任何应用程序,并且以market://details 开头的 URI 只能搜索 ?q=、按类别过滤商店 ?c= 并显示应用程序详细信息。
是否有一个 URI / Intent 可用于将用户带到任何商店的主页(系统建议有能力的市场应用程序)?
【问题讨论】:
-
您可能想查看的相关帖子(没有解决我的问题):linking to android app-store details pages、opening playstore from an android application ... 任何帮助或线索表示赞赏
标签: android kotlin android-intent fdroid