2012-04-28 30 views

回答

0

一個接收機的<application>可以包含多個<receiver>並且每個<receiver>可以包含多個<intent-filter>。例如:

<application> 

    <receiver android:name="ReceiverA"> 
     <intent-filter> 
      <action android:name="android.intent.action.ACTION1"/> 
     </intent-filter> 
    </receiver> 

    <receiver android:name="ReceiverB"> 
     <intent-filter> 
      <action android:name="android.intent.action.ACTION2" /> 
     </intent-filter> 
     <intent-filter> 
      <action android:name="android.intent.action.ACTION3" /> 
      <data android:scheme="file" /> 
     </intent-filter> 
    </receiver> 

</application> 

但是你只能有一個"com.google.android.apps.analytics.AnalyticsReceiver" - 這是IMO的文件意味着什麼。

1

是的,你可以使用一個單一的廣播接收器捕獲所有操作字符串。請確保您在該接收器使用的IntentFilter中添加了所有的操作字符串以使其工作。

+0

以及如何使用小部件廣播和其他一些接收器? – 2012-04-28 12:16:20

+0

你是什麼意思?詳細說明 – waqaslam 2012-04-28 12:19:59

0

它是爲每個濾波器