App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-10-19 7305bf92ab9951c1f42cb8e863ae1fb0d5d05d01
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
(function(w){
    
document.addEventListener('plusready',function(){
    checkArguments();
},false);
 
// 判断启动方式
function checkArguments(){
    console.log("Shortcut-plus.runtime.launcher: "+plus.runtime.launcher);
    if(plus.runtime.launcher=='shortcut'){
    try{
        var cmd = JSON.parse(plus.runtime.arguments);
        console.log("Shortcut-plus.runtime.arguments: "+plus.runtime.arguments)
        var type=cmd&&cmd.type;
        switch(type){
            case 'share':
                openWebview('plus/share.html');
            break;
            case 'about':
                openWebview('about.html','zoom-fade-out',true);
            break;
            default:
            break;
        }
    }catch(e){
        console.log("Shortcut-exception: "+e);
    }
    }
}
// 打开页面
function openWebview(id,a,s){
    if(!_openw||_openw.id!=id){
        clicked(id,a,s);
    }
}
 
// 处理从后台恢复
document.addEventListener('newintent',function(){
    console.log("Shortcut-newintent");
    checkArguments();
},false);
 
})(window);