App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-09-21 32383daed1b498577da8c37145e66e2a93e28b2d
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="HandheldFriendly" content="true">
<meta name="MobileOptimized" content="320">
<title>Device Document</title>
<link rel="stylesheet" type="text/css" href="res/doc.css" charset="utf-8">
<link rel="stylesheet" type="text/css" href="res/prettify.sons.css" charset="utf-8">
<script type="text/javascript" src="res/doc.js" charset="utf-8"></script><script type="text/javascript" src="res/prettify.js" charset="utf-8"></script>
</head>
<body><div id="content" class="content">
<h1><a name="plus.device">device</a></h1>
<p>Device模块管理设备信息,用于获取手机设备的相关信息,如IMEI、IMSI、型号、厂商等。通过plus.device获取设备信息管理对象。</p>
<h2>属性:</h2>
<ul>
<li>
<a href="#plus.device.imei">imei</a>: 设备的国际移动设备身份码</li>
<li>
<a href="#plus.device.imsi">imsi</a>: 设备的国际移动用户识别码</li>
<li>
<a href="#plus.device.model">model</a>: 设备的型号</li>
<li>
<a href="#plus.device.vendor">vendor</a>: 设备的生产厂商</li>
<li>
<a href="#plus.device.uuid">uuid</a>: 设备的唯一标识</li>
</ul>
<h2>方法:</h2>
<ul>
<li>
<a href="#plus.device.beep">beep</a>: 发出蜂鸣声</li>
<li>
<a href="#plus.device.dial">dial</a>: 拨打电话</li>
<li>
<a href="#plus.device.getInfo">getInfo</a>: 获取设备信息</li>
<li>
<a href="#plus.device.getOAID">getOAID</a>: 获取匿名设备标识符</li>
<li>
<a href="#plus.device.getVAID">getVAID</a>: 获取开发者匿名设备标识符</li>
<li>
<a href="#plus.device.getAAID">getAAID</a>: 获取应用匿名设备标识符</li>
<li>
<a href="#plus.device.getVolume">getVolume</a>: 获取设备的系统音量</li>
<li>
<a href="#plus.device.isWakelock">isWakelock</a>: 获取程序是否一直保持唤醒(屏幕常亮)状态</li>
<li>
<a href="#plus.device.setWakelock">setWakelock</a>: 设置应用是否保持唤醒(屏幕常亮)状态</li>
<li>
<a href="#plus.device.setVolume">setVolume</a>: 设置设备的系统音量</li>
<li>
<a href="#plus.device.vibrate">vibrate</a>: 设备振动</li>
</ul>
<h2>对象:</h2>
<ul>
<li>
<a href="#plus.device.DeviceInfo">DeviceInfo</a>: 设备信息对象</li>
<li>
<a href="#plus.screen">screen</a>: Screen模块管理设备屏幕信息</li>
<li>
<a href="#plus.display">display</a>: Display模块管理应用可使用的显示区域信息</li>
<li>
<a href="#plus.networkinfo">networkinfo</a>: networkinfo模块用于获取网络信息</li>
<li>
<a href="#plus.os">os</a>: OS模块管理操作系统信息</li>
</ul>
<h2>回调方法:</h2>
<ul>
<li>
<a href="#plus.device.DeviceSuccessCallback">DeviceSuccessCallback</a>: 成功回调函数</li>
<li>
<a href="#plus.device.DeviceFailCallback">DeviceFailCallback</a>: 失败回调函数</li>
<li>
<a href="#plus.device.DeviceCompleteCallback">DeviceCompleteCallback</a>: 操作完成回调函数</li>
</ul>
<h2>权限:</h2>
<p>5+功能模块(permissions)</p>
<pre class="prettyprint linenums">
{
// ...
"permissions":{
    // ...
    "Device": {
        "description": "设备信息"
    }
}
}
            </pre>
<h1><a name="plus.device.DeviceInfo">DeviceInfo</a></h1>
<p>设备信息对象</p>
<pre class="prettyprint linenums">
interface plus.device.DeviceInfo {
    attribute String imei;
    attribute String imsi;
    attribute String uuid;
}
                </pre>
<h2>属性:</h2>
<ul>
<li>imei: <em>(<font class="type">String</font>
    类型
)</em>设备的国际移动设备身份码<br><p>
    如果设备不支持或无法获取(如用户未授权)则返回空字符串。
    如果设备存在多个身份码,则以“,”字符分割拼接,如“862470039452950,862470039452943”。
                        </p>
</li>
<li>imsi: <em>(<font class="type">Array</font>[
                <font class="type">String</font>
                ]
            
    类型
)</em>设备的国际移动用户识别码<br><p>
    字符串数组类型,获取设备上插入SIM的国际移动设备身份码。
    如果设备支持多卡模式则返回所有SIM身份码。
    如果设备不支持或没有插入SIM卡则返回空数组。
                        </p>
</li>
<li>uuid: <em>(<font class="type">String</font>
    类型
)</em>设备标识<br><p>
    设备的唯一标识号。
                        </p>
</li>
</ul>
<h1><a name="plus.screen">screen</a></h1>
<p>Screen模块管理设备屏幕信息</p>
<pre class="prettyprint linenums">
interface plus.screen {
    attribute String dpiX;
    attribute String dpiY;
    attribute Number height;
    attribute Number width;
    attribute Number resolutionHeight;
    attribute Number resolutionWidth;
    attribute Number scale;
    
    function void setBrightness(brightness);
    function Number getBrightness();
    function void lockOrientation(orientation);
    function void unlockOrientation();
}
                </pre>
<h2>属性:</h2>
<ul>
<li>
<a href="#plus.screen.dpiX">dpiX</a>: 设备屏幕水平方向的密度</li>
<li>
<a href="#plus.screen.dpiY">dpiY</a>: 设备屏幕垂直方向的密度</li>
<li>
<a href="#plus.screen.height">height</a>: 屏幕高度物理分辨率</li>
<li>
<a href="#plus.screen.width">width</a>: 屏幕宽度物理分辨率</li>
<li>
<a href="#plus.screen.resolutionHeight">resolutionHeight</a>: 屏幕高度逻辑分辨率</li>
<li>
<a href="#plus.screen.resolutionWidth">resolutionWidth</a>: 屏幕宽度逻辑分辨率</li>
<li>
<a href="#plus.screen.scale">scale</a>: 逻辑分辨率与物理分辨率的缩放比例</li>
</ul>
<h2>方法:</h2>
<ul>
<li>
<a href="#plus.screen.setBrightness">setBrightness</a>: 设置屏幕亮度</li>
<li>
<a href="#plus.screen.getBrightness">getBrightness</a>: 获取屏幕亮度值</li>
<li>
<a href="#plus.screen.lockOrientation">lockOrientation</a>: 锁定屏幕方向</li>
<li>
<a href="#plus.screen.unlockOrientation">unlockOrientation</a>: 解除锁定屏幕方向</li>
</ul>
<h1><a name="plus.display">display</a></h1>
<p>Display模块管理应用可使用的显示区域信息</p>
<pre class="prettyprint linenums">
interface plus.display {
    attribute Number resolutionHeight;
    attribute Number resolutionWidth;
}
                </pre>
<h2>属性:</h2>
<ul>
<li>
<a href="#plus.display.resolutionHeight">resolutionHeight</a>: 应用可使用的屏幕高度逻辑分辨率</li>
<li>
<a href="#plus.display.resolutionWidth">resolutionWidth</a>: 应用可使用的屏幕宽度逻辑分辨率</li>
</ul>
<h1><a name="plus.networkinfo">networkinfo</a></h1>
<p>networkinfo模块用于获取网络信息</p>
<pre class="prettyprint linenums">
interface plus.networkinfo {
    const attribute Number CONNECTION_UNKNOW = 0;
    const attribute Number CONNECTION_NONE = 1;
    const attribute Number CONNECTION_ETHERNET = 2;
    const attribute Number CONNECTION_WIFI = 3;
    const attribute Number CONNECTION_CELL2G = 4;
    const attribute Number CONNECTION_CELL3G = 5;
    const attribute Number CONNECTION_CELL4G = 6;
    
    function Number getCurrentType();
}
                </pre>
<h2>常量:</h2>
<ul>
<li>
<a href="#plus.networkinfo.CONNECTION_UNKNOW">CONNECTION_UNKNOW</a>: 网络连接状态未知</li>
<li>
<a href="#plus.networkinfo.CONNECTION_NONE">CONNECTION_NONE</a>: 未连接网络</li>
<li>
<a href="#plus.networkinfo.CONNECTION_ETHERNET">CONNECTION_ETHERNET</a>: 有线网络</li>
<li>
<a href="#plus.networkinfo.CONNECTION_WIFI">CONNECTION_WIFI</a>: 无线WIFI网络</li>
<li>
<a href="#plus.networkinfo.CONNECTION_CELL2G">CONNECTION_CELL2G</a>: 蜂窝移动2G网络</li>
<li>
<a href="#plus.networkinfo.CONNECTION_CELL3G">CONNECTION_CELL3G</a>: 蜂窝移动3G网络</li>
<li>
<a href="#plus.networkinfo.CONNECTION_CELL4G">CONNECTION_CELL4G</a>: 蜂窝移动4G网络</li>
</ul>
<h2>方法:</h2>
<ul><li>
<a href="#plus.networkinfo.getCurrentType">getCurrentType</a>: 获取设备当前连接的网络类型</li></ul>
<h1><a name="plus.os">os</a></h1>
<p>OS模块管理操作系统信息</p>
<pre class="prettyprint linenums">
interface plus.os {
    attribute String language;
    attribute String name;
    attribute String vendor;
    attribute String version;
}
                </pre>
<h2>属性:</h2>
<ul>
<li>
<a href="#plus.os.language">language</a>: 系统语言信息</li>
<li>
<a href="#plus.os.name">name</a>: 系统的名称</li>
<li>
<a href="#plus.os.vendor">vendor</a>: 系统的供应商信息</li>
<li>
<a href="#plus.os.version">version</a>: 系统版本信息</li>
</ul>
<h1><a name="plus.device.DeviceSuccessCallback">DeviceSuccessCallback</a></h1>
<p>成功回调函数</p>
<pre class="prettyprint linenums">
void onSuccess(JSON event){
}
                </pre>
<h2>说明:</h2>
<p class="des">
    不同接口触发的成功回调参数event包含的属性存在差异,具体参考对应的接口描述说明。
                </p>
<h2>参数:</h2>
<ul><li>event: 
        <em>(
            <font class="type">JSON</font>
            )
            必选 </em>回调参数<br>
    回调参数包含的属性由调用接口决定,具体参考对应的接口描述说明。
                        </li></ul>
<h2>返回值:</h2>
<font class="type">void</font>
            : 无<h1><a name="plus.device.DeviceFailCallback">DeviceFailCallback</a></h1>
<p>失败回调函数</p>
<pre class="prettyprint linenums">
function void onFail(Exception error){
    // Handle error
    var code = error.code; // 错误编码
    var message = error.message; // 错误描述信息
}
                </pre>
<h2>参数:</h2>
<ul><li>error: 
        <em>(
            <font class="type">Exception</font>
            )
            必选 </em>回调参数,错误信息<br>
    可通过error.code(Number类型)获取错误编码;
    可通过error.message(String类型)获取错误描述信息。
                        </li></ul>
<h2>返回值:</h2>
<font class="type">void</font>
            : 无<h1><a name="plus.device.DeviceCompleteCallback">DeviceCompleteCallback</a></h1>
<p>操作完成回调函数</p>
<pre class="prettyprint linenums">
function void onComplete(JSON event){
}
                </pre>
<h2>说明:</h2>
<p class="des">
    调用成功或失败都会触发此回调。
                </p>
<h2>参数:</h2>
<ul><li>event: 
        <em>(
            <font class="type">JSON</font>
            )
            可选 </em>回调参数<br>
    调用成功时回调参数与DeviceSuccessCallback一致,调用失败时回调参数与DeviceFailCallback一致。
                        </li></ul>
<h2>返回值:</h2>
<font class="type">void</font>
            : 无<br><br>
</div></body>
</html>