我有一个意图i,当我通过sendOrderedBroadcast(i, null);Random 接收器广播该意图时正在调用(我知道这是完全正常的)。我使用queryBroadcastReceivers (Intent intent, int flags)并发现注册了多个广播接收器。我想将我的意图发送给特定的接收者。
任何人都可以让我知道该怎么做。
提前致谢。
我有一个意图i,当我通过sendOrderedBroadcast(i, null);Random 接收器广播该意图时正在调用(我知道这是完全正常的)。我使用queryBroadcastReceivers (Intent intent, int flags)并发现注册了多个广播接收器。我想将我的意图发送给特定的接收者。
任何人都可以让我知道该怎么做。
提前致谢。
广播接收器:
public class OutgoingReceiver extends BroadcastReceiver {
    public static final String CUSTOM_INTENT = "jason.wei.custom.intent.action.TEST";
    @Override
    public void onReceive(Context context, Intent intent) {
        System.out.println("HIT OUTGOING");
        Intent i = new Intent();
        i.setAction(CUSTOM_INTENT);
        context.sendBroadcast(i);
    }
}
将此代码添加到清单中
<receiver android:name=".IncomingReceiver" android:enabled="true">
    <intent-filter>
        <action android:name="jason.wei.custom.intent.action.TEST"></action>
    </intent-filter>
</receiver>