在我们自己的APP中,使用意图打开当前设备中安装的应用市场
public static void openAppInMarket(Context context) { if (context != null) { String pckName = context.getPackageName(); try { String uri = "market://details?id=" + pckName; Intent intent = new Intent("android.intent.action.VIEW"); intent.setData(Uri.parse(uri)); context.startActivity(intent); } catch (Exception e) { e.printStackTrace(); KLog.i("打开浏览器"); Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri uri = Uri.parse("http://www.baidu.com"); intent.setData(uri); context.startActivity(intent); } } else KLog.e("context is null"); }
|