plus,5+app根据包名查询是否安装过某个app

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<title></title>
	<script type="text/javascript">
		try {
			var packageName = 'io.dcloud.H59EAC2CB'; //包名  
			var main = plus.android.runtimeMainActivity();
			var packageManager = main.getPackageManager();
			var PackageManager = plus.android.importClass(packageManager);
			var packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
			if (packageInfo) {
				//已安装  
				plus.runtime.launchApplication({
					pname: packageName
				}, function(e) {
					alert("Open system default browser failed: " + e.message);
				});
			} else {
				//未安装  
				alert('未安装')
			}
		} catch (e) {
			//未安装  
			alert('未安装')
		}
	</script>
</head>

<body>

</body>
上一篇:历史命令、自动注销


下一篇:泛函编程(16)-泛函状态-Functional State