我已经打开谷歌播放商店使用以下代码
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=my packagename "));
startActivity(i);.
但它向我显示了一个完整的操作视图,以选择选项(浏览器/播放商店)。我需要直接在Play Store打开应用程序。
我已经打开谷歌播放商店使用以下代码
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=my packagename "));
startActivity(i);.
但它向我显示了一个完整的操作视图,以选择选项(浏览器/播放商店)。我需要直接在Play Store打开应用程序。
当前回答
如果你想从你的应用程序打开谷歌播放商店,那么直接使用这个命令:market://details?gotohome=com。yourAppName,它将打开你的应用程序的谷歌播放商店页面。
网站:http://play.google.com/store/apps/details?id= 应用:市场:/ /细节?id =
显示特定发行商的所有应用
网站:http://play.google.com/store/search?q=pub 应用:市场:/ /搜索?q =酒吧:
搜索使用标题或描述上的查询的应用程序
网站:http://play.google.com/store/search?q= 应用:市场:/ /搜索?q =
参考:https://tricklio.com/market-details-gotohome-1/
其他回答
这个链接将自动打开应用程序在市场://如果你是在Android和浏览器,如果你是在PC上。
https://play.app.goo.gl/?link=https://play.google.com/store/apps/details?id=com.app.id&ddl=1&pcampaignid=web_ddl_1
如果你想从你的应用程序打开谷歌播放商店,那么直接使用这个命令:market://details?gotohome=com。yourAppName,它将打开你的应用程序的谷歌播放商店页面。
网站:http://play.google.com/store/apps/details?id= 应用:市场:/ /细节?id =
显示特定发行商的所有应用
网站:http://play.google.com/store/search?q=pub 应用:市场:/ /搜索?q =酒吧:
搜索使用标题或描述上的查询的应用程序
网站:http://play.google.com/store/search?q= 应用:市场:/ /搜索?q =
参考:https://tricklio.com/market-details-gotohome-1/
进入Android开发者官方链接作为教程,一步一步地从play store中查看并获得应用程序包的代码,如果存在或play store应用程序不存在,然后从web浏览器中打开应用程序。
Android开发者官方链接
https://developer.android.com/distribute/tools/promote/linking.html
链接到应用程序页面
从一个网站:https://play.google.com/store/apps/details?id=<package_name>
从Android应用程序:market://details?id = < package_name >
链接到产品列表
从一个网站:https://play.google.com/store/search?q=pub:<publisher_name>
从Android应用程序:market://search?q =酒吧:< publisher_name >
链接到搜索结果
从网站:https://play.google.com/store/search?q=<search_query>&c=apps
从Android应用程序:market://search?q = < seach_query >和c =应用
试试这个
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.example.android"));
startActivity(intent);
而Eric的答案是正确的,Berťák的代码也可以工作。我认为这两者结合起来更优雅。
try {
Intent appStoreIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName));
appStoreIntent.setPackage("com.android.vending");
startActivity(appStoreIntent);
} catch (android.content.ActivityNotFoundException exception) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
通过使用setPackage,您可以强制设备使用Play Store。如果没有安装Play Store,异常将被捕获。