1、進程與線程相當于車間與流水線,而包名就相當于車間名。

2、創(chuàng)建進程:android:process
? ? ? 還可以為每一個Activity,組件命名進程名。
? ? ? android:process = “:push”; ?//在進程的空間里附加一個進程,在原來的進程名后面加上:push。

3、進程的等級:
? ? ? ? ? ?前臺進程、可見進程、服務(wù)進程、后臺進程、空進程
4、進程的回收是根據(jù)進程的等級進行回收的
5、多進程間的通信IPC(inter process communication)
? ? 全局初始化多進程會初始化多遍,比較耗資源也比較費電。
? ? 進程間的內(nèi)存不可見
? ? 為什么需要多進程之間的通信:內(nèi)存不共享
? ? 如何實現(xiàn)通信:系統(tǒng)實現(xiàn)、Message(多進程單線程)-->利用Handler(單進程多線程)、AIDL(多進程多線程)。
6、Message


6、AIDL(Android Interface definition language)
? ? ?新建AIDL文件

dradle build 生成下面的接口類:

新建person類,并安裝插件Parceable,利用parceable自動實現(xiàn)接口


在activity中綁定service



7、服務(wù)與通知
? ? ?service 小結(jié):種類--》Local(當前進程的service,依附在主進程,節(jié)約資源)、Remote(另外一個進程,獨立的 ? ? ? ? ? ? ? ? ? ? ? ? ? 進程,當主進程被kill,還可以運行)
? ? ? ? ? ? ? ? ? ? ? ? ?類型--》前臺(在通知欄一直顯示)、后臺
? ? ? ? ? ? ? ? ? ? ? ? ?啟動方式--》start、bind
? ? ? 前臺服務(wù): ?Notification
? ? ? ? ? ? ? ? ? ? ? ?下面對Notification類中的一些常量,字段,方法簡單介紹一下:
? ? ? ? ? ? ? ? ? ? ? ? 常量:
? ? ? ? ? ? ? ? ? ? ? ?DEFAULT_ALL??? 使用所有默認值,比如聲音,震動,閃屏等等
? ? ? ? ? ? ? ? ? ? ? ?DEFAULT_LIGHTS 使用默認閃光提示
? ? ? ? ? ? ? ? ? ? ? ?DEFAULT_SOUNDS 使用默認提示聲音
? ? ? ? ? ? ? ? ? ? ? ?DEFAULT_VIBRATE 使用默認手機震動【說明】:加入手機震動,一定要在manifest.xml中加入權(quán)限
? ? ? ? ? ? ? ? ? ? ? ?NotificationManager常用方法介紹:
? ? ? ? ? ? ? ? ? ? ? ?publicvoidcancelAll() 移除所有通知(只是針對當前Context下的Notification)
? ? ? ? ? ? ? ? ? ? ? ?publicvoidcancel(intid) 移除標記為id的通知 (只是針對當前Context下的所有Notification)
? ? ? ? ? ? ? ? ? ? ? ?publicvoidnotify(String tag ,intid, Notification notification) 將通知加入狀態(tài)欄,標簽為tag,標 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 記為id
? ? ? ? ? ? ? ? ? ? ? ?publicvoidnotify(intid, Notification notification) 將通知加入狀態(tài)欄,標記為id
? ? ? ? ? ? ? ? ? ? ? ?對于Notification的實現(xiàn)可以參考http://blog.csdn.net/loongggdroid/article/details/17616509