如何直接从我的Android应用程序打开Amazon AppStore?

时间:2016-03-05 18:51:08

标签: android amazon updates amazon-appstore

我从iPhone上看到了有关亚马逊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“相同”?

2 个答案:

答案 0 :(得分:6)

亚马逊应用商店URI

amzn://apps/android?

指向特定的应用程序看起来像

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

来源:Linking To the Amazon Appstore for Android

答案 1 :(得分:1)

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

如果没有网络视图,该怎么做:

(来自docs)

  

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

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

使用webview:

 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);

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