【问题标题】:How to open the Amazon AppStore directly from my Android application?如何直接从我的 Android 应用程序打开 Amazon AppStore?
【发布时间】:2016-06-19 12:05:11
【问题描述】:

我从 iPhone 上看到了有关 Amazon Appstore 的答案,但在 Android 上没有。我正在尝试制作一个按钮,可以在我的应用页面上打开 Amazon Appstore(适用于 android)。

这是在 Google Play 上的做法:

final String appPackageName = context.getPackageName();

try {
    activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)); 
} catch (android.content.ActivityNotFoundException e) {
    activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName));
}

我应该如何替换字符串以便它在 Amaozn AppStore 中“同样”工作?

【问题讨论】:

标签: android amazon updates amazon-appstore


【解决方案1】:

亚马逊应用商店 URI 是

amzn://apps/android?

定向到特定应用程序看起来像

amzn://apps/android?p=com.amazon.mp3

来源:Linking To the Amazon Appstore for Android

【讨论】:

  • 感谢您的回答!正是我想要的!
  • 他们似乎在最近的版本中删除了这个——它甚至也没有原生地处理网络搜索。一定是搞错了……
【解决方案2】:

查看 WebView。它完全符合您的要求,您可以在自己的应用程序中打开一个页面。只需在xml中定义一个webview,然后使用java来显示页面。

没有 webview 怎么办:

(来自文档)

默认情况下,WebView 不提供类似浏览器的小部件,不提供 启用 JavaScript 和网页错误将被忽略。如果你的目标是 只是为了显示一些 HTML 作为 UI 的一部分,这可能很好; 用户除了阅读网页之外不需要与网页进行交互, 并且网页不需要与用户交互。如果你真的 想要一个成熟的网络浏览器,那么你可能想要调用 带有 URL Intent 的浏览器应用程序,而不是使用 网络视图。例如:

Uri uri = Uri.parse("http://www.example.com");
 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
 startActivity(intent);

使用网页视图:

 webview.loadUrl("http://slashdot.org/");

 // OR, you can also load from an HTML string:
 String summary = "<html><body>You scored <b>192</b> points.</body></html>";
 webview.loadData(summary, "text/html", null);

通过评论告诉我这是否有效。

【讨论】:

  • 我想使用 Intent 选项。你能帮我弄弦吗?
  • 看看评论中的重复。 OP想使用intents,需要知道Android中Amazon App Store应用的URI字符串
  • @UFCInsider 看看cricket_007 的回答,看看你需要放什么字符串。然后,使用我的答案中描述的语法使其真正起作用
  • @cricket_007 哦,好的。这对我来说不是很清楚。希望 OP 仍然可以将此答案与您的答案一起使用来完成他/她的任务。我赞成你的回答:)
  • 谢谢你们! @cricket_007 的答案正是我想要的!
猜你喜欢
  • 1970-01-01
  • 2012-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-24
  • 2021-01-08
  • 1970-01-01
  • 2012-01-26
相关资源
最近更新 更多