点击网页上的按钮,判断如果本地已经安装了这个app就打开,如果没有安装就跳转到下载页面去下载
网页端要做的处理:
loadInstalledApplication = function(){
window.location.href = 'com.demo.app://';
window.setTimeout(function(){
if (owner.getPlatformName() == owner.IOS) {
window.location.href = "http://download.demo.app.com";
} else if (owner.getPlatformName() == owner.ANDROID) {
window.location.href = "http://download.demo.app.com";
}
},2000)
}
如果只是测试,可以用下边的代码替换上边的代码测试。
打开app
app端要做的处理:
android:scheme="com.demo.app" />
注意: intent-filter的内容android.intent.action.MAIN和 android.intent.action.VIEW这2个不能同时放到同一个intent-filter中,否则可能会导致app图标找不到。
应该如下:
android:name="...activity.StartActivity"
android:configChanges="orientation|locale"
android:screenOrientation="portrait">
android:scheme="com.demo.app" />