如何直接从我的 Android 应用程序打开 Amazon AppStore?
How to open the Amazon AppStore directly from my Android application?
我从 iPhone 看到了有关 Amazon Appstore 的答案,但没有从 Android 看到答案。我正在尝试制作一个按钮,用于在我的应用程序页面上打开 Amazon Appstore(对于 android)。
以下是 Google 播放的完成方式:
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 "the same" 上正常工作?
查看 WebView。它完全符合您的要求,您可以在自己的应用程序中打开一个页面。只需在xml中定义一个webview,然后使用java来显示页面。
没有webview怎么办:
(来自文档)
By default, a WebView provides no browser-like widgets, does not
enable JavaScript and web page errors are ignored. If your goal is
only to display some HTML as a part of your UI, this is probably fine;
the user won't need to interact with the web page beyond reading it,
and the web page won't need to interact with the user. If you actually
want a full-blown web browser, then you probably want to invoke the
Browser application with a URL Intent rather than show it with a
WebView. For example:
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);
通过评论让我知道这是否有效。
亚马逊应用商店 URI 是
amzn://apps/android?
定向到特定应用看起来像
amzn://apps/android?p=com.amazon.mp3
我从 iPhone 看到了有关 Amazon Appstore 的答案,但没有从 Android 看到答案。我正在尝试制作一个按钮,用于在我的应用程序页面上打开 Amazon Appstore(对于 android)。
以下是 Google 播放的完成方式:
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 "the same" 上正常工作?
查看 WebView。它完全符合您的要求,您可以在自己的应用程序中打开一个页面。只需在xml中定义一个webview,然后使用java来显示页面。
没有webview怎么办:
(来自文档)
By default, a WebView provides no browser-like widgets, does not enable JavaScript and web page errors are ignored. If your goal is only to display some HTML as a part of your UI, this is probably fine; the user won't need to interact with the web page beyond reading it, and the web page won't need to interact with the user. If you actually want a full-blown web browser, then you probably want to invoke the Browser application with a URL Intent rather than show it with a WebView. For example:
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);
通过评论让我知道这是否有效。
亚马逊应用商店 URI 是
amzn://apps/android?
定向到特定应用看起来像
amzn://apps/android?p=com.amazon.mp3