Appinventor-Webview无法打开应用程序链接

时间:2019-04-22 18:49:22

标签: android app-inventor

我正在App Inventor WebView中尝试在应用商店中打开应用链接。 html链接打开Playstore网站的移动版本,但这不是我所需要的。我需要该链接在Google Play商店应用中打开该应用。

此html页面嵌入在WebView中。 然后是带有whatsapp应用程序的示例

<a href="https://play.google.com/store/apps/details?id=com.whatsapp">Buy it now</a>

我也尝试了market://,但是它不起作用。

2 个答案:

答案 0 :(得分:1)

使用webviewer组件的 WebViewString 属性将URL传递回App Inventor。然后使用Activity Starter在Google Play中打开该应用。

How does the property Webviewer.WebViewString work?
How to launch Google Play from within your app

答案 1 :(得分:0)

如果要从Android应用程序链接到产品,请创建一个可打开URL的Intent。配置此Intent时,请将“ com.android.vending”传递到Intent.setPackage()中,以便用户在Google Play商店应用中(而不是选择器中)看到您应用的详细信息。

以下示例指导用户在Google Play中查看包含程序包名称com.example.android的应用程序。

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(
        "https://play.google.com/store/apps/details?id=com.example.android"));
intent.setPackage("com.android.vending");
startActivity(intent);

这是针对原生android开发的。您可以执行类似的方式:

Action:android.intent.action.VIEW
DataUri:https://play.google.com/store/apps/details?id=com.example.android
ActivityPackage:com.android.vending
相关问题