Android開(kāi)發(fā)之廣播的基本使用說(shuō)明_第1頁(yè)
Android開(kāi)發(fā)之廣播的基本使用說(shuō)明_第2頁(yè)
Android開(kāi)發(fā)之廣播的基本使用說(shuō)明_第3頁(yè)
Android開(kāi)發(fā)之廣播的基本使用說(shuō)明_第4頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、¡¡¡¡1¡¢Android¹ã²¥·¢Ëͼ°¹ã²¥ÀàÐÍ¡¡¡¡¹ã²¥·¢Ë͵Ļù±¾´úÂë:¡¡

2、61;¡¸ù¾Ý¹ã²¥µÄ·¢ËÍ·½Ê½£¬¿ÉÒÔ½«Æä·ÖΪÒÔϼ¸ÖÖÀàÐÍ£º¡¡

3、61;¡1£©ÆÕͨ¹ã²¥ Normal Broadcast¡¡¡¡2£©ÏµÍ³¹ã²¥ System Broadcast¡¡¡¡3) ÓÐÐò¹ã²¥ Ordered Broadcast¡¡¡

4、¡4£©Õ³ÐԹ㲥 Sticky Broadcast (ÔÚAndroid 5.0/Api 21Öв»ÍƼöʹÓã¬ÓÐÐòÕ³ÐԹ㲥ҲÒÑ

5、0;­²»ÍƼöʹÓÃ)¡¡¡¡5£©Ó¦ÓÃÄڹ㲥 Local Broadcast£¨Ê¹ÓÃLocalBroadcastManager£¬Ö»ÄÜÔÚÓ¦&

6、#211;ÃÄÚʹÓ㬲»ÄÜ¿ç½ø³ÌʹÓᣣ©¡¡¡¡1£©ÆÕͨ¹ã²¥ Normal Broadcast¡¡¡¡¿&

7、#170;·¢Õß×Ô¼º¶¨ÒåµÄintent,ÒÔcontext.sendBroadcast(.)»òÕßcontext.sendBroadcastAsUser(.)ÐÎʽ·¢ËÍ¡£¡¡¡¡¾ßÌå¿

8、ÉÒÔʹÓõķ½·¨ÓУº¡¡¡¡sendBroadcast(.):¡¡¡¡¢ÙsendBroadcast(RequiresPermission Intent intent);¡¡¡¡¢ÚsendBroadcast(RequiresPermission Inte

9、nt intent, Nullable String receiverPermission);¡¡¡¡¢ÛsendBroadcast(Intent intent, Nullable String receiverPermission, Nullable Bundle options);¡¡¡¡¢ÜsendBroadcast(Intent intent, String receiverPermission, int appOp);¡¡¡¡

10、sendBoadcastAsUser(.)¡¡¡¡¢ÙsendBroadcastAsUser(RequiresPermission Intent intent, UserHandle user);¡¡¡¡¢ÚsendBroadcastAsUser(RequiresPermission Intent intent, UserHandle user, Nullable String receiverPermission);¡¡¡¡¢

11、;ÛsendBroadcastAsUser(RequiresPermission Intent intent, UserHandle user, Nullable String receiverPermission, int appOp);¡¡¡¡2£©ÏµÍ³¹ã²¥ System Broadcast¡¡¡¡AndroidϵͳÄÚÖ

12、ÃÁ˶à¸ö¹ã²¥£¬Éæ¼°µ½ÊÖ»úµÄ»ù±¾²Ù×÷£¬»ù±¾É϶¼»á·¢³öÏ

13、àÓ¦µÄϵͳ¹ã²¥¡£¡¡¡¡ÏµÍ³¹ã²¥ÔÚϵͳÄÚ²¿µ±Ìض¨Ê¼þ·¢É

14、úʱ£¬ÓÉϵͳ·¢³ö¡£¡¡¡¡3£©ÓÐÐò¹ã²¥ Ordered Broadcast¡¡¡¡ÓÐÐò¹ã²¥ÊÇÕë

15、;¶Ô¹ã²¥½ÓÊÕÕߣ¨BroadcastReceiver£©¶øÑÔ£¬°´ÕÕÏȺó˳Ðò½ÓÊյġ£¡¡¡¡Ï

16、Ⱥó˳ÐòÅжϱê׼Ϊ£º°´ÕÕPriorityÓÉ´óµ½Ð¡ÅÅÐò£»ÓÐÏàͬpriorityµÄ¶¯&#

17、204;¬¹ã²¥ºÍ¾²Ì¬¹ã²¥£¬¶¯Ì¬¹ã²¥»áÅÅÔÚÇ°Ãæ¡£¡¡¡¡4£©Õ³ÐÔ¹ã&

18、#178;¥(Sticky Broadcast)¡¡¡¡ÒѾ­ÔÚAndroid 5.0/Api 21Öв»ÍƼöʹÓá¡¡¡5£©Ó¦ÓÃÄڹ㲥(Local Broadcast)¡&

19、#161;¡¡ÓÃLocalBroadcastManagerͳһ´¦ÀíAPPÓ¦ÓÃÄڵĹ㲥ÎÊÌâ¡£¡¡¡¡Android¹ã²¥¿ÉÒÔ¿ç

20、½ø³ÌÉõÖÁ¿çAPP·¢ËÍ£¬»áÔì³ÉÒ»ÏÂÎÊÌ⣺¡¡¡¡¢ÙÆäËûÓ¦ÓÿÉÄ

21、20;»áÕë¶Ôµ±Ç°APP£¬·¢ËÍÓ뵱ǰAPP intent-filterÒ»ÖµĹ㲥£¬µ¼ÖÂAPP²»¶ÏµÄ½

22、1;Êպʹ¦Àí£»¡¡¡¡¢ÚÆäËûÓ¦ÓÿÉÒÔ×¢²áÓ뵱ǰAPP intent-filterÒ»ÖµĹã²

23、;¥£¬ÓÃÓÚ½ÓÊչ㲥ÐÅÏ¢¡£¡¡¡¡ÒÔÉÏÁ½ÖÖÇé¿ö¶¼´æÔÚ°²È«Òþ»

24、;¼£¬³£¼ûµÄÔö¼Ó°²È«ÐԵķ½°¸ÊÇ£º¡¡¡¡¢Ù±¾µØAPPÄÚ²¿·¢ËͺÍ&#

25、189;ÓÊյĹ㲥£¬½«exportedÊôÐÔÉèΪfalse¡£¡¡¡¡¢ÚÔÚ·¢ËͺͽÓÊչ㲥ʱ&

26、#163;¬Ôö¼ÓÉÏÏàÓ¦µÄpermission£¬ÓÃÓÚȨÏÞÑéÖ¤¡£¡¡¡¡¢Û·¢Ë͹㲥ʱ£¬

27、14;¸¶¨¹ã²¥½ÓÊÕÆ÷ËùÔڵİüÃû¡¡¡¡2¡¢¹ã²¥·¢ËͺͽÓÊÕµÄÔ­Àí&#

28、161;¡¡¡³ýÓ¦ÓÃÄڹ㲥£¬ÆäËû¹ã²¥·¢ËͺͽÓÊÕÔ­Àí¡¡¡¡¢Ù¼Ì³ÐBr

29、oadcastReceiver£¬ÖØдonReceive()·½·¨£»¡¡¡¡¢Úͨ¹ýBinder»úÖÆÏòActivityManagerService×¢²á¹ã²¥¡¡¡¡¢

30、Ûͨ¹ýBinder»úÖÆÏòActivityManagerService·¢Ë͹㲥¡¡¡¡¢ÜAMS²éÕÒ·ûºÏÌõ¼þ£¨IntentFilter/Permission£©

31、µÄBroadcastReceiver£¬½«¹ã²¥·¢Ë͵½BroadcastReceiverËùÔÚµÄÏûÏ¢¶ÓÁÐÖС£¡¡¡¡¢ÝBroadcastReceiverË

32、49;ÔڵĶÓÁÐÊÕµ½´Ë¹ã²¥ºó£¬»Øµ÷onReceive()·½·¨¡£¡¡¡¡Ó¦ÓÃÄڹ㲥£

33、2;·¢ËͺͽÓÊÕÔ­ÀíÓëÆÕͨ¹ã²¥»ù±¾Ò»Ö£¬½«ActivityManagerService»»ÎªLocalManagerService¿ØÖ

34、;ƹ㲥µÄ½ÓÊպͷ¢Ë͵ÈÁ÷³Ì¡£¡¡¡¡3¡¢¹ã²¥Êý¾ÝµÄÏÞÖÆ£¨Î´

35、9;éÖ¤£¬´ýÑéÖ¤£©¡¡¡¡¹ã²¥´«ÊäÊý¾Ý´óСӦ¸Ã¾¡¿ÉÄܵÄС¡£

36、8;»ÄÜÌ«´ó¡£Í¼Æ¬»òÕßÌ«³¤µÄ×Ö·û´®Ó¦¸ÃÒÔ±ðµÄ·½Ê½´«µÝ¡£

37、1;¡¡¡½ø³ÌÄÚ£¬¿ÉÒÔÓÃEventBus£¬Îļþ»º´æ£¬´ÅÅÌ»º´æ¡£¡¡¡¡¹ÙÍøÉ&#

38、207;¶ÔTransationTooLargeExceptionÓÐÈçÏÂ˵Ã÷£º¡¡¡¡TransactionTooLargeException¡¡¡¡The Binder transaction failed because it was too large.¡¡¡¡During a remote procedure call

39、, the arguments and the return value of the call are transferred asParcelobjects stored in the Binder transaction buffer. If the arguments or the return value are too large to fit in the transaction buffer, then the call will fail andTransactionTooLargeExceptionwill be thrown.¡¡¡¡

40、;The Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. Consequently this exception can be thrown when there are many transactions in progress even when most of the individual transactions are of moderate size.¡

41、61;¡¡There are two possible outcomes when a remote procedure call throwsTransactionTooLargeException. Either the client was unable to send its request to the service (most likely if the arguments were too large to fit in the transaction buffer), or the service was unable to send its respon

42、se back to the client (most likely if the return value was too large to fit in the transaction buffer). It is not possible to tell which of these outcomes actually occurred. The client should assume that a partial failure occurred.¡¡¡¡The key to avoidingTransactionTooLargeExcepti

43、onis to keep all transactions relatively small. Try to minimize the amount of memory needed to create aParcelfor the arguments and the return value of the remote procedure call. Avoid transferring huge arrays of strings or large bitmaps. If possible, try to break up big requests into smaller pieces.

44、¡¡¡¡Òâ˼´ó¸ÅÊÇ˵¡¡¡¡Í¨¹ýBinder»º³åÇøÖеÄParcel¶ÔÏó½øÐд«Êä¡£

45、BinderÊÂÎñ»º³åÇø¾ßÓÐÓÐÏ޵Ĺ̶¨´óС£¬µ±Ç°Îª1Mb¡£¡¡¡¡Óɵ±Ç°

46、89;ø³ÌÕýÔÚ½øÐеÄËùÓÐÊÂÎñ¹²Ïí¡£Òò´Ë£¬¼´Ê¹´ó¶àÊýµ¥¸öÊÂ

47、06;ñµÄ´óСÊÊÖУ¬µ±ÓÐÐí¶àÊÂÎñÕýÔÚ½øÐÐʱ£¬Ò²»áÅ׳ö´ËÒì

48、79;£¡£¡¡¡¡µ±Å׳öTransactionTooLargeExceptionʱ£¬ÓÐÁ½ÖÖ¿ÉÄܵÃÔ­Òò¡£¿Í»§¶ËÎÞ·¨

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論