在移动版android中打开google play store链接
我在最新的应用程序中有我的其他应用程序的链接,我用这种方式打开它们在移动版android中打开google play store链接,android,google-play,Android,Google Play,我在最新的应用程序中有我的其他应用程序的链接,我用这种方式打开它们 Uri uri = Uri.parse("url"); Intent intent = new Intent (Intent.ACTION_VIEW, uri); startActivity(intent); 此代码将打开google play store的浏览器版本 当尝试从手机打开时,手机会提示我是否要使用浏览器或google play,如果我选择第二个浏览器或google play,手机会打开移动版的google pl
Uri uri = Uri.parse("url");
Intent intent = new Intent (Intent.ACTION_VIEW, uri);
startActivity(intent);
此代码将打开google play store的浏览器版本
当尝试从手机打开时,手机会提示我是否要使用浏览器或google play,如果我选择第二个浏览器或google play,手机会打开移动版的google play商店
你能告诉我这怎么会马上发生吗?我的意思是不要问我,而是直接打开google play的移动版,即我在从手机直接打开时看到的版本。您需要使用指定的
市场协议:
final String appPackageName = "com.example"; // Can also use getPackageName(), as below
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
请记住,这将在未安装市场的任何设备上崩溃(例如,emulator)。因此,我建议如下:
final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName)));
}
使用from上下文
或其子类以保持一致性(谢谢!)。您可以在此处找到更多关于市场的信息:您可以使用库在Google Play上打开应用程序页面,如下所示:
Intent intent = IntentUtils.openPlayStore(getApplicationContext());
startActivity(intent);
下面的代码可能会帮助您在手机版中显示google play的应用程序链接
申请链接:
Uri uri = Uri.parse("market://details?id=" + mContext.getPackageName());
Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
startActivity(myAppLinkToMarket);
} catch (ActivityNotFoundException e) {
//the device hasn't installed Google Play
Toast.makeText(Setting.this, "You don't have Google Play installed", Toast.LENGTH_LONG).show();
}
开发者链接:
Uri uri = Uri.parse("market://search?q=pub:" + YourDeveloperName);
Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
startActivity(myAppLinkToMarket);
} catch (ActivityNotFoundException e) {
//the device hasn't installed Google Play
Toast.makeText(Settings.this, "You don't have Google Play installed", Toast.LENGTH_LONG).show();
}
您可以检查是否安装了Google Play Store应用程序,如果是这种情况,您可以使用“market://”协议
final String my_package_name = "........." // <- HERE YOUR PACKAGE NAME!!
String url = "";
try {
//Check whether Google Play store is installed or not:
this.getPackageManager().getPackageInfo("com.android.vending", 0);
url = "market://details?id=" + my_package_name;
} catch ( final Exception e ) {
url = "https://play.google.com/store/apps/details?id=" + my_package_name;
}
//Open the app page in Google Play store:
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(intent);
final String my_package_name=“……///在Google Play上打开应用程序页面:
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=" + context.getPackageName()));
startActivity(intent);
在浏览器中打开以下内容不会打开Google Play:market://details?id=pandoraThe ID是程序包名称,而不是应用程序名称。试试market://details?id=com.PandoraTV
(假设是您想要的应用程序)。这个答案是关于从您自己的应用程序使用市场://
前缀,而不是通过浏览器从网站使用前缀。我可以证明它的功能(在2.3、3.x、4.0、4.1和4.2版本上),并且它可以与股票浏览器、Chrome Beta 25和Chrome 18一起使用。是的,Chrome是一个应用程序,但这需要它的制造商[谷歌]使用此代码,而不是[你]制作网站的人。目前,此代码旨在帮助专门从应用程序构建链接的用户。您可以使用getPackageName()
自动检索应用程序id。我希望倒数第二段对我来说是正确的。使用此处找到的http链接:不会提示用户选择应用程序或浏览器。它始终假定浏览器为空。不幸的是,我也不能使用market://
协议。还有其他人看到这种行为吗?请注意,这是不鼓励的,因此答案应该是搜索解决方案的终点(而不是另一个中途停留的引用,它往往会随着时间的推移变得过时)。请考虑在这里添加一个独立的概要,保持链接作为参考。这将有助于包括一个免责声明,这是你的库,几乎与接受的答案相同。