四大组件注册

  1. myreceiver = new MySMSReceiver();
  2.         ifilter = new IntentFilter();
  3.         ifilter.addAction("android.provider.Telephony.SMS_RECEIVED");

  1.     //动态注册广播接收器  
  2.         msgReceiver = new MsgReceiver();  
  3.         IntentFilter intentFilter = new IntentFilter();  
  4.         intentFilter.addAction("com.example.communication.RECEIVER");  
  5.         registerReceiver(msgReceiver, intentFilter);  

XML:

全局的,服务,监听其他应用
  1.         <receiver android:name=".MyReceiver">
  2.             <intent-filter>
  3.                 <action android:name="android.intent.action.EDIT"/>
  4.             </intent-filter>
  5.         </receiver>



        <!--
            如果有需要用到的 service ,则都要在这里做相应的配置
        
-->
        
<service android:name=".MyService"></service>

<provider android:name=".PersonContentProvider"    
  android:authorities="cn.itcast.providers.personprovider"/>


1
2
3
4
5
<service android:enabled= "true"  android:name= ".MusicService" >
<intent-filter>
<action android:name= "org.allin.android.musicService"  />
</intent-filter>
</service>
 
  

        

你可能感兴趣的:(四大组件注册)