Почему Broadcastreceiver не получает намерения, если приемник и фильтр не установлены в манифесте? - PullRequest
1 голос
/ 13 декабря 2011

Почему Broadcastreceiver не получает намерения, если приемник и фильтр не установлены в манифесте?

Рабочая 1:

locationNotific = new Intent(PROXIMITY_STRING);

    lPendingIntent = PendingIntent.getBroadcast(this, 0, locationNotific, PendingIntent.FLAG_CANCEL_CURRENT);


       filter = new IntentFilter(PROXIMITY_STRING); 

     contextOnCreate.registerReceiver(new ProximityIntentReceiver(), filter);

    lm.addProximityAlert(LatitudeE6ForPeox1,LongitudeE6ForPeox1,POINT_RADIUS,-1,lPendingIntent);

В манифесте 1:

<receiver android:name=".ProximityIntentReceiver">
<intent-filter>
<action  android:name="SendProximityIntent">
</action>           
</intent-filter>
</receiver>

Рабочая 2:

filter = new IntentFilter(PROXIMITY_STRING); 

         contextOnCreate.registerReceiver(new ProximityIntentReceiver(), filter);

          sendBroadcast(locationNotific);//working becouse of that (dosent work just with proximity)

Дозировка Работает:

    identif=Long.toString(id);
    locationNotific = new Intent(PROXIMITY_STRING + identif);

    lPendingIntent = PendingIntent.getBroadcast(this, 0, locationNotific, PendingIntent.FLAG_CANCEL_CURRENT);



       filter = new IntentFilter(PROXIMITY_STRING + identif); 

     contextOnCreate.registerReceiver(new ProximityIntentReceiver(), filter);

    lm.addProximityAlert(LatitudeE6ForPeox1,LongitudeE6ForPeox1,POINT_RADIUS,-1,lPendingIntent);
...