1. Activity
2. Broadcastreceiver
3.services
4.contentProvider
A. The broadcast recipient ,---------------trigger the Onreceiver method when the specified broadcast is received. This class needs to inherit Broadcastreceiver
public void OnReceive (context context, Intent Intent) {
Broadcast triggers need to be included in the configuration list
<receiver android:name= "Com.example.ipdailer.CallCast" > <intent-filter > <action android: Name= "Android.intent.action.NEW_OUTGOING_CALL"/> </intent-filter> </receiver>
Can also be configured by code
Registration of broadcasting, cancellation of registration Unregisterreceiver (receiver);
New mybroadrecastreceiver (); // Create Intent-filter set a broadcast action New Intentfilter (); Filter.addaction (Intent.action_screen_off); Filter.addaction (intent.action_screen_on); // start registering a broadcast Registerreceiver (receiver, filter);
Second, the opening way of service service
1. StartService can still exist in memory after the activity is destroyed.
2.bindService destroyed with activity destruction. (You can return a Binder object to return the methods in the service to the activity call through binder)
Seventh Day Android 4 components