File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,13 @@ Service有两种方式开启,**startService** 和 **bindService** 区别在于
12
12
13
13
![ ] ( http://images.cnitblog.com/blog/325852/201303/24233205-ccefbc4a326048d79b111d05d1f8ff03.png )
14
14
15
- IntentService:带有工作线程的service,原理基于HandlerThread
15
+ ** IntentService** :带有工作线程的service,原理基于HandlerThread
16
+
17
+ ### 保活
18
+
19
+ - ` onStartCommand ` 方法的返回值设置为START_STICKY,在意外停止后会被重启
20
+ - 通过` startForeground ` 设置为前台进程,且常驻在通知栏
21
+ - 通过多进程Service互相绑定守护
22
+ - AlarmManager不断地唤醒
23
+ - 监听锁屏、解锁,通过1像素的Activity维持前台进程
24
+ - 联系厂商,加入白名单(;¬_ ¬)
Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ Hyper Text Transfer Protocol,超文本传输协议,基于**TCP/IP**的一个
6
6
7
7
- 1.0:客户端每次与web服务器建立连接一次只能获取一个资源,每次都需要三次握手
8
8
9
- - 1.1:允许客户端和web服务器建立连接后获取多个资源,现在绝大多数都是用的此协议(默认Connection: Keep-Alive )
9
+ - 1.1:允许客户端和web服务器建立连接后获取多个资源(长连接) ,现在绝大多数都是用的此协议(默认Connection: Keep-Alive )
10
10
11
- - 2.0:压缩了HTTP协议的头信息,减少数据包的大小,多路复用机制,提高响应速度,允许通过单一的连接来发起多重的请求
11
+ - 2.0:压缩了HTTP协议的头信息,减少数据包的大小,多路复用机制,提高响应速度,允许通过单一的连接来发起多重的请求,并且从1.x的基于文本格式的解析变成了二进制格式,提高了健壮性
12
12
13
13
### 访问过程
14
14
You can’t perform that action at this time.
0 commit comments