1.ServiceåIntentServiceåºå«
2.android:怎样将Uri类型的数据转换成流
ServiceåIntentServiceåºå«
1>ï¼Serviceæå¡æ¯é¿æè¿è¡å¨åå°ï¼
2>ï¼å®ä¸æ¯åç¬çè¿ç¨ï¼å 为å®ååºç¨ç¨åºå¨åä¸ä¸ªè¿ç¨ï¼
3>ï¼ä¹ä¸æ¯åç¬ç线ç¨ï¼å®è·çº¿ç¨æ²¡æä»»ä½å ³ç³»ï¼æ以ä¸è½è¿è¡èæ¶æä½ï¼
4>ï¼å¦æç´æ¥æèæ¶æä½æ¾å¨Serviceä¸çonStartCommand()ä¸ï¼å¯è½åçANRï¼å¦ææèæ¶æä½ï¼å°±å¿ é¡»å¼å¯ä¸ä¸ªåç¬ç线ç¨æ¥å¤çï¼
为äºè§£å³è¿æ ·çé®é¢ï¼å°±å¼å ¥äºIntentServiceï¼
1>ï¼å¯å¨æ¹å¼åServiceä¸æ ·ï¼é½æ¯startService()ï¼
2>ï¼ç»§æ¿äºServiceï¼å å«Serviceææç¹æ§ï¼å æ¬çå½å¨æï¼æ¯å¤çå¼æ¥è¯·æ±çä¸ä¸ªç±»ï¼ï¼
3>ï¼ä¸è¬èªå®ä¹ä¸ä¸ªInitializeService继æ¿Serviceï¼ç¶åå¤åonHandleIntent()æ¹æ³ï¼å¨è¿ä¸ªæ¹æ³ä¸åå§åè¿äºç¬¬ä¸æ¹çï¼æ¥æ§è¡èæ¶æä½ï¼
4>ï¼å¯ä»¥å¯å¨å¤æ¬¡IntentServiceï¼æ¯ä¸ä¸ªèæ¶æä½ä»¥å·¥ä½éåå¨onHandleIntent()æ¹æ³ä¸æ§è¡ï¼æ§è¡å®ç¬¬ä¸ä¸ªåå»æ§è¡ç¬¬äºä¸ªï¼ä»¥æ¤ç±»æ¨ï¼
5>ï¼ææç请æ±é½å¨å线ç¨ä¸ï¼ä¸ä¼é»å¡ä¸»çº¿ç¨ï¼åä¸ä¸ªæ¶é´åªå¤çåä¸ä¸ªè¯·æ±ï¼
6>ï¼ä¸éè¦åå¨Serviceä¸ä¸æ ·ï¼æå¨å¼å¯çº¿ç¨ï¼ä»»å¡æ§è¡å®æåä¸éè¦æå¨è°ç¨stopSelf()æ¹æ³æ¥åæ¢æå¡ï¼ç³»ç»ä¼èªå¨å ³éæå¡ï¼
1>ï¼ä¸è¬ç¨äºAppå¯å¨æ¶å¨BaseApplicationä¸åå§åä¸äºç¬¬ä¸æ¹çä¸è¥¿ï¼æ¯å¦è ¾è®¯Buglyãè ¾è®¯X5WebViewãOk/xihe/article/details/,使用前需要先依赖Okhttp3
防止查看源码防止查看源码