App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-10-22 40711118c33369ccad7ceda0fdd729bd9f117f65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8"/>
        <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
        <meta name="HandheldFriendly" content="true"/>
        <meta name="MobileOptimized" content="320"/>
        <title>Hello H5+</title>
        <script type="text/javascript" src="../js/common.js"></script>
        <script type="text/javascript">
if(window.plus){
    if(document.body){
        outLine( currentTimeString()+" HTML5 Plus已准备" );
    }else{
        document.addEventListener("DOMContentLoaded",function(){
            outLine( currentTimeString()+" HTML5 Plus已准备" );
        },false);
    }
}else{
    document.addEventListener("plusready",function(){
        outLine( currentTimeString()+" HTML5 Plus已准备" );
    }, false );
}
document.addEventListener("pause",function(){
    outLine( currentTimeString()+" 应用从前台切换到后台" );
}, false );
document.addEventListener("resume",function(){
    outLine( currentTimeString()+" 应用从后台切换到前台" );
}, false );
document.addEventListener("netchange",function(){
    var types = {};
    types[plus.networkinfo.CONNECTION_UNKNOW] = "未知";
    types[plus.networkinfo.CONNECTION_NONE] = "未连接网络";
    types[plus.networkinfo.CONNECTION_ETHERNET] = "有线网络";
    types[plus.networkinfo.CONNECTION_WIFI] = "WiFi网络";
    types[plus.networkinfo.CONNECTION_CELL2G] = "2G蜂窝网络";
    types[plus.networkinfo.CONNECTION_CELL3G] = "3G蜂窝网络";
    types[plus.networkinfo.CONNECTION_CELL4G] = "4G蜂窝网络";
    outLine( currentTimeString()+" 切换网络:"+types[plus.networkinfo.getCurrentType()] );
}, false );
document.addEventListener("newintent",function(){
    outLine( currentTimeString()+" 从第三方应用启动:"+plus.runtime.arguments );
}, false );
function currentTimeString(){
    var d = new Date();
    return d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()+"."+d.getMilliseconds()+" - ";
}
        </script>
        <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8"/>
    </head>
    <body>
        <br/>
        <p class="des">按“HOME”键切换应用触发“pause”和“resume”事件,在设置中改变网络配置触发“netchange”事件。</p>
        <br/>
        <div id="outpos"/>
        <div id="output">
Events模块管理客户端事件,包括系统事件,如扩展API加载完毕、程序前后台切换等。<br/>
        </div>
    </body>
</html>