1

受信者とフィルターがマニフェストに設定されていないのに、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)

Dosent Working:

    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);
4

0 に答える 0