QIntent rBroafl CasU

ftWX!l¥>im Intent nj l^ltJ^Pi^J -^frfl<J Activity, fflft Intent Intent mi« fi W a «Jjft ftff ^J * M

SMfftlfJfl LiMj£JBiS#J£ Android Intent r «Mrt-. iflj i\-m(ti Broadcast Receiver nlW&WIntent, # ft^Intent MiiWftigo

«ill, ^rfeiftifeftJKitiik. Android

Intent iitfj-r fflo jli^» Broadcast Receiver, M&ffi*!Vlftft&mWt:

iVJf' Mjr» Intent £lt«1BttMftS + RJBBWifttf Intent, jRjgiHffl sendBroadcast public static final String NEW BROADCAST "com.eoeandroid.action.NEW BROADCAST";

Intent intent = new Intent (NEW BROADCAST );

intent.putExtra(Mdatal", some-Data);

intent.putExtra("data2", someData);

sendBroadcast(intent) ;

a* Ti" iSW a»JB" -Intent ft Broadcast

9.2.2 Broadcast Receiver

flfl- ^ Broadcast Receiver, if-H *Kff<J W^/iJMj&'r Broadcast Receiver Intent Filter

$!IS£SiifM Broadcast Receiver fiXiJ»® Intent UtifHSHi.

1. JiQfSi^Iie—Broadcast Receiver

«IfJ^Wfflil^./i: BroadcastReceiver #+ onReceive imtU

Kffr>n:

public class EoeAndroidReceiver extends BroadcastReceiver I @Override public void onReceive(Context context. Intent intent) ( }

ft onReceive 5s W««, An*5*ff-Mii. Android Hi ->h

BroadcastReceiver Milffft"JlKtfffl^W Intent MMlH

m. Aztiimmm. tnmMrmmm. mm*mH -mmmm\\mm?r0

2. infirawfnaai Broadcast Receiver

Liffi BroadcastReceiver in' T'A">i'J£TlitfJ"54iW»

WiyPltfTfHBW BroadcastReceiver , {HJE»3Eft»T$fHttir4fc«. Jn^ilfi^fl »6, AWSLft (ft BroadcastReceiver

MlnTliilifiilWttA'^Xi BroadcastReceiver iflifi^WK

»-tt/jiifii: AndroidManifest.xml ffij H.&«JVt&

tfljWc ItJlll-ftffW hii^aiWii^ BroadcastReceiver ftWilJJfcSt^t ¿-, ^-«"«^SilT:

creceiver android:name="EoeAndroidReceiver"> <intent-fi1ter>

<action android:name="com.eoeandroid.action.NEW BROADCAST"/>

</intent-filter>

</receiver>

Intent Filter filter = new IntentFilter(NEW BROADCAST ); EoeAndroidReceiver eoeandroidReceiver = new EoeAndroidReceiver (); registerReceiver(eoeandroidReceiver , filter);

to BroadcastReceiver it «Wig, "J'tUlfl Kj&MfW:

unregisterReceiver (eoear.droidReceiver) ;

E3 jsffl^^

^Tstiifitk-r-^j k&frmmm, MJ»*T aiia^««^. m mX'm'^m BroadcastReceiver *H Android Tá'j' F&^tfiJ Ffi^ltft^J

0 0

Post a comment