android ´óÉñÐÂÊÖÇóÖú°¡¡£¡£¡£ÔÚAndroidManifest.xmlÖжà¸öintent-filterÊôÐÔ,ÔõôÇø·ÖÄĸöÊÇÖ÷Èë¿Ú°¡¡£
Ò»¸öÓ¦ÓóÌÐò¿ÉÒÔÓжà¸öActivity£¬Ã¿¸öActivityÊÇͬ¼¶±ðµÄ£¬ÄÇôÔÚÆô¶¯³ÌÐòʱ£¬×îÏÈÆô¶¯ÄĸöActivityÄØ£¿ÓÐЩ³ÌÐò¿ÉÄÜÐèÒªÏÔʾÔÚ³ÌÐòÁбíÀÓÐЩ²»ÐèÒª¡£Ôõô¶¨ÒåÄØ£¿android.intent.action.MAIN¾ö¶¨Ó¦ÓóÌÐò×îÏÈÆô¶¯µÄActivity
£¬android.intent.category.LAUNCHER¾ö¶¨Ó¦ÓóÌÐòÊÇ·ñÏÔʾÔÚ³ÌÐòÁбíÀï¡£MainºÍLAUNCHERͬʱÉ趨²ÅÓÐÒâÒ壬
Èç¹ûÓжà¸öͬ¼¶µÄActivity¶¼ÓйýÂËÆ÷
ÔòÖ»ÓÐ×îÇ°ÃæµÄActivityµÄ <action
android:name="android.intent.action.MAIN"
/> ÓÐЧ£¬Æô¶¯¸Ã³ÌÐòʱ£¬Ö´ÐеÄÊǸÃActivity¡£ÇÒÔÚ³ÌÐòÁбíÖÐÓжà¸öͼ±ê£¬ÕâЩActivity¶¼ÔÚ³ÌÐòÁбíÖÐÏÔʾ£¬¸ÃApplicationÓжà¸öÈë¿Ú£¬Ö´Ðв»Í¬µÄActivity,µ«ÊÇÕû¸ö³ÌÐòµÄÖ÷Èë¿Ú£¨Õû¸ö³ÌÐò×îÏÈÔËÐеÄÄǸöactivity£©Ö»ÓÐ×îÏȶ¨ÒåµÄÄǸöActivity¡£
Èç ¹ûÒ»¸öÓ¦ÓÃûÓÐLAUNCHERÔò¸ÃapkÈÔÄÜ°²×°µ½É豸ÉÏ£¬µ«ÊÇÔÚÖ÷³ÌÐòͼÖп´²»µ½¡£Èç¹û¸øÄǸöActivity
É趨ÁËLAUNCHER£¬ÇÒͬʱÉ趨ÁËMain,ÔòÕâ¸öActivity¾Í¿É³öÏÖÔÚ³ÌÐòͼÖУ»Èç¹ûûÓÐMain£¬Ôò²»ÖªÆô¶¯ÄĸöActivity£¬¹ÊÒ²²»»áÓÐͼ±ê³öÏÖ¡£
androidÖУ¬intentfilterÔõô¶¯Ì¬Ìí¼ÓÊôÐÔ
ǧ ·æ¿Û¶¡Ñ§ÌÃiOS¿ª·¢ÎªÄú½â´ð: 1. Android°Ñ°²×°µÄ°üÖпɻñµÃµÄIntent Filter·Åµ½Ò»¸öÁбíÖС£ 2. ¶¯×÷ºÍÓëÕýÔÚ½âÎöµÄIntentµÄÖÖÀ಻¹ØÁªµÄIntent Filter»á´ÓÁбíÖÐɾ³ý¡£ 2.1. ¶¯×÷Æ¥ÅäÖ¸Android Intent Filter°üº¬Ìض¨µÄ¶¯×÷»òûÓÐÖ¸¶¨µÄ¶¯×÷¡£Ò»¸öIntent FilterÓÐÒ»¸ö»ò¶à¸ö¶¨ÒåµÄ¶¯×÷£¬Èç¹ûûÓÐÈκÎÒ»¸öÄÜÓëIntentÖ¸¶¨µÄ¶¯×÷Æ¥ÅäµÄ»°£¬Õâ¸öIntent FilterÔÚËã×÷ÊǶ¯×÷Æ¥Åä¼ì²éʧ°Ü¡£ 2.2. ÖÖÀàÆ¥Åä¸üΪÑϸñ¡£Intent Filter±ØÐë°üº¬ËùÓÐÔÚ½âÎöµÄIntentÖж¨ÒåµÄÖÖÀà¡£Ò»¸öûÓÐÌض¨ÖÖÀàµÄIntent FilterÖ»ÄÜÓëûÓÐÖÖÀàµÄIntentÆ¥Åä¡£ 3. IntentµÄÊý¾ÝURIÖеIJ¿·Ö»áÓëIntent FilterÖеÄdata±êÇ©±È½Ï¡£Èç¹ûIntent Filter¶¨Òåscheme£¬host/authority£¬path»òmimetype£¬ÕâЩֵ¶¼»áÓëIntentµÄURI±È½Ï¡£Èκβ»Æ¥Å䶼»áµ¼ÖÂIntent Filter´ÓÁбíÖÐɾ³ý¡£ ûÓÐÖ¸¶¨dataÖµµÄAndroid Intent Filter»áºÍËùÓеÄIntentÊý¾ÝÆ¥Åä¡£ 3.1. mimetypeÊÇÕýÔÚÆ¥ÅäµÄÊý¾ÝµÄÊý¾ÝÀàÐÍ¡£µ±Æ¥ÅäÊý¾ÝÀàÐÍʱ£¬Äã¿ÉÒÔʹÓÃͨÅä·ûÀ´Æ¥Åä×ÓÀàÐÍ£¨ÀýÈ磬earthquakes/*£©¡£Èç¹ûIntent FilterÖ¸¶¨Ò»¸öÊý¾ÝÀàÐÍ£¬Ëü±ØÐëÓëIntentÆ¥Å䣻ûÓÐÖ¸¶¨Êý¾ÝµÄ»°È«²¿Æ¥Åä¡£ 3.2. schemeÊÇURI²¿·ÖµÄÐÒ顪¡ªÀýÈ磬http:£¬mailto:£¬tel:¡£ 3.3. host-name»ò¡°data authority¡±ÊǽéÓÚURIÖÐschemeºÍpathÖ®¼äµÄ²¿·Ö¡£Æ¥ÅäÖ÷»úÃûʱ£¬Intent FilterµÄschemeÒ²±ØÐëͨ¹ýÆ¥Åä¡£ 3.4. Êý¾ÝpathÊǽô½ÓÔÚ¡°data authority¡±µÄºóÃ棨ÀýÈ磬/ig£©¡£pathÖ»ÔÚschemeºÍhost-name²¿·Ö¶¼Æ¥ÅäµÄÇé¿öϲÅÆ¥Åä¡£ 4. Èç¹ûÕâ¸ö¹ý³ÌÖжàÓÚÒ»¸ö×é¼þ½âÎö³öÀ´µÄ»°£¬ËüÃÇ»áÒÔÓÅÏȶÈÀ´ÅÅÐò£¬¿ÉÒÔÔÚAndroid Intent FilterµÄ½ÚµãÀïÌí¼ÓÒ»¸ö¿ÉÑ¡µÄ±êÇ©¡£×î¸ßµÈ¼¶µÄ×é¼þ»á·µ»Ø¡£ Android±¾µØµÄÓ¦ÓóÌÐò×é¼þºÍµÚÈý·½Ó¦ÓóÌÐòÒ»Ñù£¬¶¼ÊÇIntent½âÎö¹ý³ÌÖеÄÒ»²¿·Ö¡£ËüÃÇûÓиü¸ßµÄÓÅÏȶȣ¬¿ÉÒÔ±»ÐµÄActivityÍêÈ«µÄ´úÌ棬ÕâЩеÄActivityÐû¸æ×Ô¼ºµÄIntent FilterÄÜÏìÓ¦ÏàͬµÄ¶¯×÷ÇëÇó¡£
ÈçºÎÔÚ¶¯Ì¬ÅäÖõÄbroadcastreceiverÀï½ÓÊÕµ½action
1.×Ô¶¨ÒåÒ»¸ö¹ã²¥´¦ÀíÕß
//Èç¹û¹ã²¥Ê¼þ´¦ÀíÀàÊÇÒ»¸öÄÚ²¿ÄڵĻ°£¬Ò»¶¨ÒªÉùÃ÷ΪstaticµÄ£»Èç¹û»¹Òª×¢²áΪ×Ô¶¨Òå¹ã²¥ÄÇôҪÔÚÖ÷ÅäÖÃÎļþÖÐreceiver android:nameÉùÃ÷¸ñʽΪ**.**.**.¸¸Àà$µ±Ç°Àà
public class MyCustomReceiver extends BroadcastReceiver{
//´¦Àí¹ã²¥
@Override
public void onReceive(Context context, Intent intent) {
//½ÓÊչ㲥½øÐд¦Àí
String cmdAction=intent.getAction();//»ñÈ¡µ±Ç°¹ã²¥µÄaction
if("cn.android.app.current_weather".equals(cmdAction)){
String getValue=intent.getStringExtra("weatherState");//»ñÈ¡µ±Ç°¹ã²¥µÄdata ;
System.out.println("¹ã²¥½ÓÊܳɹ¦£¬µ±Ç°µÄ´«µÝµÄÐÅÏ¢ÊÇ£º"+getValue);
}
}
}
ʹÓÃ×Ô¼ºµÄ¹ã²¥£¬¿ÉÒÔÔÚÖ÷ÅäÖÃÎļþxmlÖÐʹÓÃreceiver±êÇ©£¨×¢²á´¦Àí¹ã²¥µÄBroadcastReceiverÀࣩºÍ×Ó±êÇ©intent-filter£¨ÐèÒªaction ÊôÐÔÀ´¹ýÂ˹㲥£¬ÒÔ±ã½ÓÊܹ㲥ʱÄÜ»ñÈ¡¶ÔÓ¦µÄÄǸö¹ã²¥£©±êÇ©½øÐй㲥µÄ¾²Ì¬×¢²á£¬È»ºóÔÚ´úÂëÖÐÖ»ÐèÒª·¢Ë͹㲥¾Í¿ÉÒÔÁË£¬³ÌÐò»á×Ô¼ºÈ¥Ñ°ÕÒÖ÷ÅäÖÃÎļþÖÐËùÅäÖõĶÔÓ¦¹ã²¥µÄ´¦ÀíÕߣ»
ÔÚ´úÂëÖз¢ËÍ×Ô¶¨Òå¹ã²¥ºó£¬ÏµÍ³³ýÁË»á×Ô¶¯µ÷ÓöÔÓ¦£¨actionÒ»Ö£©µÄÔÚÖ÷ÅäÖÃÎļþÖÐʹÓÃreceiver±êǩע²á¹ã²¥µÄ¹ã²¥´¦ÀíÀà,»¹»áµ÷ÓÃÔÚ·¢Ë͹㲥֮ǰ£¬ÆäËûͨ¹ý´úÂë×¢²áÁ˹㲥µÄ´¦ÀíÕß £»Ò»°ã¶ÔÓÚ×Ô¶¨Òå¹ã²¥µÄ´¦ÀíÕߣ¬Ò»°ã¾ÍÒ»¸ö,¶àÊÇʹÓÃÖ÷ÅäÖÃÎļþ¾²Ì¬×¢²á¹ã²¥´¦ÀíÕßÀ´´¦Àí¹ã²¥.
£¨ÎÞÂÛÊÇÔÚ´úÂëÖл¹ÊÇÔÚÖ÷ÅäÖÃÎļþÖУ¬ÎÒÃǶ¼¿ÉÒÔ×¢²á¶à¸ö¹ã²¥´¦ÀíÕßÒÔ¹²Í¬½ÓÊÜ´¦Àí¹ã²¥£¬²»¹ýÎÞÂÛÔÚÄǸöµØ·½×¢²á£¬Í¬Ò»¹ã²¥´¦ÀíÕßÔÚËùÔÚ×¢²áÇøÓò£¬Ö»ÄÜÓÐЧע²áÒ»´Î£¬Öظ´²»»á±¨´í£¬Ö»ÊÇÎÞЧ).
ʹÓÃ×Ô¶¨ÒåÒ»¸ö¹ã²¥´¦ÀíÕß¿ÉÒÔÔÚÖ÷ÅäÖÃÎļþÖнøÐо²Ì¬×¢²á£¬ÄÇôÔÚ·¢Ë͹㲥֮ºó£¬¹ã²¥´¦ÀíÕß¾ÍÄܽÓÊÕµ½¹ã²¥ÁË£¬¶øÇÒÕâÖÖÐÎʽÊÇ°éËæ×ÅÕû¸öÓ¦ÓõÄÉúÃüÖÜÆÚ(Èç¹ûÕâÖÖ·½Ê½´¦ÀíµÄ¹ã²¥ÊÇϵͳ¹ã²¥µÄ»°£¬ÄÇô²»¹ÜÓ¦ÓóÌÐòÊÇ·ñ¿ªÆô£¬¸Ã¹ã²¥´¦ÀíÕ߶¼ÄܽøÐжԹ㲥µÄ´¦Àí)£¬²»Ïñ´úÂëÄÇÑùÖ»»á°éËæ×Åcontext£¨Ò»°ãÊÇÖ¸activityºÍService£©µÄÉúÃüÖÜÆÚ£»
¹ã²¥´¦ÀíÕß(receiver)×¢²á+¹ã²¥¹ýÂËÆ÷ÉùÃ÷(intent-filter) £¬ÔÚÖ÷ÅäÖÃÎļþÖÐʹÓò»È»ºÁÎÞÒâÒ壻
×¢Ò⣺
(1) £¬ Æäʵ¶ÔÓÚ×Ô¶¨ÒåµÄ¹ã²¥µÄ´¦Àí£¬Ò²ÍêÈ«¿ÉÒÔ²»ÔÚÖ÷ÅäÖÃÎļþÖнøÐÐÈçÉÏ×¢²á£¬Ö»ÒªÎÒÃÇÔÚ·¢ËÍ×Ô¶¨Òå¹ã²¥Ö®Ç°£¬½øÐÐÁ˹㲥´¦ÀíÕßµÄ×¢²á(×¢²áºóÒªÔÚÉúÃüÖÜÆÚ½áÊøʱ£¬Ð¶Ôع㲥,²»È»»á±¨´í)£¬ÄÇôÔÚ·¢ËÍ×Ô¶¨Òå¹ã²¥ºóÒÀÈ»Äܹ»´¦Àíµ½¹ã²¥¡£
£¨²»¹ý´úÂë×¢²áµÄ¶ÔÓÚ×Ô¶¨Òå¹ã²¥µÄ´¦ÀíºÍÔÚÖ÷ÅäÖÃÎļþÖеľ²Ì¬×¢²áÇø±ðÊDz»ÄÜ°éËæÕû¸öÓ¦ÓóÌÐò£¬Ö»ÄÜÊÇËùÔÚcontext£¨Ò»°ãÊÇÖ¸activityºÍService£©µÄÉúÃüÖÜÆÚ;»¹ÓУ¬×Ô¶¨Òå¹ã²¥ÖеÄaction¿ÉÒÔËæ±ã¶¨Ò壬ֻҪע²áºÍ·¢Ë͹㲥ʱʹÓõÄÊÇÒ»Öµģ¬ÄÇô¾ÍÄÜʵÏֶԹ㲥ʼþµÄ´¦Àí£©;
(2) £¬ ÔÚÖ÷ÅäÖÃÎļþÖнøÐжԹ㲥ʼþ´¦ÀíÕߵľ²Ì¬×¢²á£¬Ò»°ãÊÇÁ½¸öÔÒò :
1,²»¹ÜÔÚËùÔÚ³ÌÐòÊÇ·ñ¿ªÆô¶¼Òª´¦Àíϵͳ¹ã²¥ ;
2,ÃâÈ¥ÁËÔÚ´úÂëÐèÒªÊÂÏÈ×¢²áµÄÇé¿ö£¬ÔÚ´úÂëÖÐÖ»Ðè·¢Ë͹㲥¾Í¿ÉÒԶԹ㲥µÄ½øÐд¦Àí£¬ÇÒÕâÖֹ㲥´¦ÀíÕßµÄÉúÃüÖÜÆÚÊÇ°éËæÕû¸öÓ¦ÓóÌÐò(×Ô¶¨Òå¹ã²¥)»òÕßÕû¸öϵͳ£¨ÏµÍ³¹ã²¥£© ;
ËùÒÔÊÇ·ñͨ¹ýÖ÷ÅäÖÃÎļþ×¢²á¹ã²¥´¦ÀíÕߣ¬»¹ÊǸù¾ÝÐèÇóÀ´¶¨.
2.·¢Ë͹㲥
·¢Ë͹㲥һ°ãÓÉÁ½²¿·Ö×é³É£º1:action £¨Ö¸¶¨ÎªÊÇÄÇÖֹ㲥£©; 2:data £¨Ö¸¶¨¹ã²¥µÄÐÅÏ¢£©;ÆäÖеÚÒ»¸öÊdzɹ¦·¢³ö¹ã²¥Ëù±ØÐëÒªµÄ£»
´úÂëʵÀý
ÀàÐͺͽâ˵
// 1£ºÊµÀý»¯Ò»¸öIntent¶ÔÏó
Intent intent = new Intent();
// 2:Ìí¼Ó¹ã²¥µÄaction
intent.setAction(Intent.ACTION_EDIT);
// 3£ºµ÷ÓÃsendBroadcast°Ñ¹ã²¥·¢ËͳöÈ¥
sendBroadcast(intent);
£¨1£©·¢ËÍϵͳ¹ã²¥
Èç¹ûÔÚÖ÷ÅäÖÃÎļþÖÐͨ¹ý±êÇ©ÀïÃæÒýÓÃÁ˶ÔÓ¦µÄϵͳ¹ã²¥µÄ»°
(¶ÔÓ¦ÏÂÃæ·¢Ë͹㲥µÄintent-filter actionµÄÊÇ"android.intent.action.EDIT")£¬ÄÇôÔÚϵͳ¹ã²¥·¢³öÖ®ºó£¨ÕâÀïͨ¹ý´úÂë·¢ËÍϵͳ¹ã²¥£©£¬ÏµÍ³¾Í»á×Ô¶¯·¢Ë͹㲥¸øÄǸö¹ã²¥´¦ÀíÀࣻ
// 1£ºÊµÀý»¯Ò»¸öIntent¶ÔÏó
Intent intent = new Intent();
// 2:Ìí¼Ó¹ã²¥µÄaction,actionµÄÖµÊÇ×Ô¶¨ÒåµÄ;
intent.setAction("cn.android.app.current_weather");
//3.Ìí¼Ó·¢Ë͹㲥µÄdata,ÒԱ㴦ÀíÕßÕë¶Ô¶ÔÓ¦µÄ¹ã²¥´¦Àí£¬ÓÐÊý¾Ý¿ÉÒÔʹÓÃ;
intent.putExtra("weatherState", "¹þ¹þ");
//4£ºµ÷ÓÃsendBroadcast°Ñ¹ã²¥·¢ËͳöÈ¥
sendBroadcast(intent);
(2)·¢ËÍ×Ô¶¨ÒåµÄ¹ã²¥
3.¶¯Ì¬×¢²á¹ã²¥´¦ÀíÕß
¶¯Ì¬×¢²á¹ã²¥´¦ÀíÕß,Ò²¾ÍÊÇͨ¹ý´úÂë×¢²á¹ã²¥´¦ÀíÕߣ¬ËüµÄÉúÃüÖÜÆÚ°éËæ×Åcontext£¨Ò»°ãÊÇÖ¸activityºÍService£©£»
Èç¹û×¢²áµÄ¹ã²¥´¦ÀíÕßÖ»ÐèÒªÔÚ³ÌÐòÔËÐÐƬ¶ÎµÄʱºòÈ¥´¦Àí¹ã²¥£¬²»ÐèÒªÔÚÖ÷ÅäÖÃÎļþÖнøÐо²Ì¬×¢²áµÄ»°£¬¾ÍÈçÏ£¬Ö±½Óͨ¹ý´úÂë×¢²á¹ã²¥´¦ÀíÕߣ»
´úÂëʵÀý
ÀàÐͺͽâ˵
//´´½¨Intent¹ýÂËÆ÷ʵÀý
IntentFilter intentFilter=new IntentFilter();
//¸ø¹ýÂËÆ÷ÉèÖÃÏàÓ¦µÄaction
intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
intentFilter.addAction(Intent.ACTION_MEDIA_REMOVED);
intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
intentFilter.addAction(Intent.ACTION_BOOT_COMPLETED);
//intentFilter.addAction(Intent.action_Me)
//×¢²á¹ÒÔع㲥
MReceiver mReceiver=MReceiver();
registerReceiver(mReceiver, intentFilter);
//жÔع㲥
unregisterReceiver(mReceiver);
(1).×¢²á½ÓÊÜϵͳ¹ã²¥µÄ¹ã²¥´¦ÀíÀࣻ
// ´´½¨Intent¹ýÂËÆ÷ʵÀý
IntentFilter intentFilter = new IntentFilter();
// ¸ø¹ýÂËÆ÷ÉèÖÃÏàÓ¦µÄaction
intentFilter.addAction("cn.android.app.current_weather");
//×¢²á¹ÒÔع㲥
MReceiver mReceiver=MReceiver();
registerReceiver(mReceiver, intentFilter);
//жÔع㲥
unregisterReceiver(mReceiver);
(2).×¢²á½ÓÊÜ×Ô¼ºµÄ¹ã²¥µÄ¹ã²¥´¦ÀíÀà;
4.¾²Ì¬×¢²á¹ã²¥´¦ÀíÕß
¾²Ì¬×¢²áÒ²¾ÍÊÇÔÚÖ÷ÅäÖÃÎļþÖнøÐеĶÔÓڹ㲥µÄ´¦ÀíÕßµÄ×¢²á,ËüµÄÐÎʽ£ºÐèҪͨ¹ýreceiverÉùÃ÷¹ã²¥´¦ÀíÕߣ¬intent-filter actionÉùÃ÷ËùÒª´¦ÀíµÄ¹ã²¥¡£
Èç¹ûÒ»¸ö¹ã²¥´¦ÀíÕß²»¹ÜËù¹éÊôµÄ³ÌÐòÊÇ·ñ¿ªÆô¶¼Òª´¦Àíϵͳ¹ã²¥µÄ»°£¬ÄÇôÐèÒªÔÚÖ÷ÅäÖÃÎļþÀïÃæ½øÐÐ×¢²á,ÕâÖÖ¾²Ì¬×¢²áµÄÖ÷ÒªÊÇÕë¶ÔÓÚϵͳ¹ã²¥µÄ´¦ÀíÕߣ¬ËüµÄÉúÃüÖÜÆÚ½«»á°éËæÕû¸öϵͳ¡£
×¢Ò⣺
ÈôÔÚÖ÷ÅäÖÃÎļþÖо²Ì¬×¢²áµÄÊÇ×Ô¶¨Òå¹ã²¥´¦ÀíÀ࣬ÄÇôÔÚ´úÂëÖз¢ËÍÁË×Ô¶¨ÒåµÄ¹ã²¥ºó£¬ÏµÍ³»á×Ô¶¯·¢Ë͹㲥µ½×¢²á¹ã²¥Ê±µÄ¹ã²¥´¦ÀíÕߣ¬ÕâÖÖ¶ÔÓÚ×Ô¶¨Òå¹ã²¥µÄ´¦ÀíÕߵľ²Ì¬×¢²á£¬ËüµÄÉúÃüÖÜÆÚÊÇÕû¸öÓ¦ÓóÌÐò¡£
BroadcastReceiver¹ã²¥´¦ÀíÕß¾²Ì¬×¢²á
ÖµµÄÒ»ÌáµÄÊÇ£º
×ܽ᣺
1,ÔÚ´úÂëÖÐÈç¹û×¢²áÁËBroadcastReceiver£¬ÄÇôÔڹرÕcontext£¨Ò»°ãÊÇÖ¸activityºÍService£©Ê±Ò»¶¨ÒªÔÚonDestroy·½·¨Àï»òcontextÏûÍö֮ǰжÔØ×¢²á£¬»¹ÓÐжÔØ×¢²áÇ°Ò»¶¨ÒªÏÈ×¢²á,²»È»¶¼»á±¨´í,¿ÉÒÔͨ¹ýÒ»¸öflagÀ´±ê¼Ç×¢²á»òÕßжÔØ;
2£¬ÔÚ´úÂëÖлòÕßÖ÷ÅäÖÃÎļþÖÐÖظ´Ê¹ÓÃÒ»¸öBroadcastReceiver×¢²áͬһ¸ö¹ã²¥²»»á±¨´í,Ö»ÊÇ,Öظ´×¢²áÎÞЧ(±ÈÈçÔÚ´úÂëÖУ¬²»¹ÜÖØÐÂʵÀý»¯¶àÉٴΣ¬Ö»ÒªËùʹÓõĹ㲥´¦Àí¶ÔÏóÊÇͬһ¸öBroadcastReceiverÀà),ÈÔÈ»ÊÓΪֻע²áÁËÒ»´Î,ÎÞÂÛÊÇ´úÂëÖл¹ÊÇÖ÷ÅäÖÃÎļþÖÐ £»
3.ÔÚ´úÂëÖлòÕßÖ÷ÅäÖÃÎļþÖÐÖظ´Ê¹ÓÃÒ»¸öBroadcastReceiver×¢²á½ÓÊÕ¶à¸ö²»Í¬µÄ¹ã²¥ÊÇ¿ÉÒÔµÄ,ÔÚBroadcastReceiver×¢²áʱËùÖ¸ÏòµÄÕâЩ¹ã²¥±»·¢³öºó£¬BroadcastReceiver¶¼ÄÜÊÕµ½£¬²»¹ýÒªÔÚBroadcastReceiverÖÐÐèÒª¸ù¾ÝactionÅжϵ±Ç°ÊÕµ½µÄºÎÖֹ㲥Ȼºó½øÐзֱð´¦Àí ;
£¨´úÂëÖÐÖظ´Ê¹ÓÃIntentFilterµÄaddAction·½·¨£¬»òÕßÖØÐÂʵÀý»¯IntentFilterÔÙaddActionÈ»ºó×¢²áµ½¹ã²¥È¥ £»
ͬÀíÖ÷ÅäÖÃÎļþÖÐÖظ´Ê¹ÓõĵÄ<action±êÇ©£©
4£¬ÈôÊÇʹÓÃͬһ¸ö¹ã²¥´¦ÀíÀàÔÚ´úÂëÖкÍÖ÷ÅäÖÃÎļþÖзֱð½øÐÐ×¢²á£¬ÄÇôÔڹ㲥·¢³öºó£¬¸Ã¹ã²¥´¦ÀíÀà»á´¦ÀíÁ½´Î¹ã²¥ £¬²»¹ýÏñÇ°Ãæ×¢Òâ2˵µÄ£¬ËûÃÇ·Ö²¼ÔÚ¸÷×ÔµÄ×¢²áÇøÓò×î¶àÓÐЧע²áΪµÚÒ»´Î£¬ Öظ´×¢²áÎÞЧ ;
תÔؽö¹©²Î¿¼£¬°æȨÊôÓÚÔ×÷Õß