Android 如何从活动中安装GooglePlay的应用程序?安卓
我做了一个简单的代码,可以从Google Play下载一个应用程序 代码并在真实设备上进行了测试,但我得到了一个名为“没有应用程序可以执行此操作”的错误。我在清单中声明了android.permission.INTERNET,但仍然不起作用。 如果你能帮我,我会很高兴的Android 如何从活动中安装GooglePlay的应用程序?安卓,android,Android,我做了一个简单的代码,可以从Google Play下载一个应用程序 代码并在真实设备上进行了测试,但我得到了一个名为“没有应用程序可以执行此操作”的错误。我在清单中声明了android.permission.INTERNET,但仍然不起作用。 如果你能帮我,我会很高兴的 Intent i = new Intent(android.content.Intent.ACTION_VIEW); i.setData(Uri.parse("market://developer?*/urlof
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("market://developer?*/urlofgoogleplay*/"));
chooser = Intent.createChooser(i,"Launch Market");
startActivity(chooser);
这是正确的语法:
i.setData(Uri.parse("market://details?id=" + app_package));
这是真正的设备上有播放存储吗?
public static void linkGooglePlay(Context context) {
Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
context.startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
context.startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id=" + context.getPackageName())));
}
}