webapp通过JS代码与移动APP交互

复制地址:http://blog.csdn.net/sky_monkey/article/details/22938125

<span style="font-size:18px;"><script>  
function startAPP(){  
window.location = "**://**.**/**";  
}  
function downloadAPP(){  
window.location = "http://IP/**/**.apk";  
}  
 
</script>  
<style type="text/css">  
        body{background:#D2D460;text-align:center;margin-top:10%}  
        div{width:100%;margin:0 auto;background:#fff;text-align:left;}  
</style>  
</head>  
<body>  
<img src=images/start.png alt=打开APP οnclick=startAPP() ></img>
<img src=images/download.png alt=打开APP οnclick=downloadAPP() ></img>
<img src=images/welcome.png alt=打开APP οnclick=startAPP() ></img>
</body></html>


在app里面需要做以下设置(一般是在manifest.xml文件的activity的 intent filter里面)

    <span style="font-size:18px;"><intent-filter>  
                   <action android:name="android.intent.action.VIEW" />  
                   <category android:name="android.intent.category.DEFAULT" />  
                   <category android:name="android.intent.category.BROWSABLE" />  
                   <data   
                android:scheme="**"   
                android:host="**.**"   
                android:pathPrefix="/**">  
             </data>  
    </intent-filter></span> 

转载于:https://my.oschina.net/686991/blog/526432

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值