zoukankan      html  css  js  c++  java
  • 通过网页的JS代码启动移动APP

    <span style="font-size:18px;"><script>
    function startAPP(){
    window.location = "scheme name://**.**/**";
    }
    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>
    
    <?php 
    $var_name =  $_GET["isappinstalled"]; 
    if ($var_name=="1"){
        echo '<img src=images/start.png alt=打开APP onclick=startAPP() ></img>';
    }else if ($var_name=="0"){
        echo '<img src=images/download.png alt=打开APP onclick=downloadAPP() ></img>';
    }else{
        echo '<img src=images/welcome.png alt=打开APP onclick=startAPP() ></img>';
    }
    ?>
    
    </body></span>

    在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="**" //scheme name 'TencentQQ'
                android:host="**.**" 
                android:pathPrefix="/**">
             </data>
    </intent-filter></span>
  • 相关阅读:
    react阻止默认事件
    react组件直接在document上添加事件
    react组件更新swiper
    react组件里阻事件冒泡
    react生命周期获取异步数据
    加油
    redis教程
    redis哨兵机制
    redis复制
    致自己
  • 原文地址:https://www.cnblogs.com/sunshq/p/3753580.html
Copyright © 2011-2022 走看看