判断手机是否安装某一应用
上述的packagename
是你要检测的应用的包名,怎么查看包名请自行百度哈!
判断好之后,我们可以定义,当有地图应用的时候,就跳转到地图应用,当无地图应用的时候,就跳转到网页:
跳转到高德地图:
参数:
act=android.intent.action.VIEWdat=androidamap://keywordNavi?sourceApplication=softname&keyword=方恒国际中心 &style=2pkg=com.autonavi.minimap上述dat参数中的
keyword
后面是你要传给高德地图app的参数Intent intent=new Intent(act, android.net.Uri.parse(dat));intent.setPackage(pkg);intent.startActivity(intent);这样就可以了,当然了,当手机中没有安装高德地图时,你可以跳转到网页:
act=android.intent.action.VIEWdat=http://m.amap.com/?k=方恒国际中心上述
dat
参数中的k后面是你要传给高德地图网页的参数Intent intent=new Intent(cat,dat);intent.startActivity(intent);这样就比较完整了。