多个意图广播



我有一个推送通知应用程序。我创建了点击通知的意图:

Intent open = new Intent();
    open.setAction("com.bupyc.pushall.app.OPEN");
    open.putExtra("url", url);
    open.putExtra("lid", lid);
    open.putExtra("regId", regId);
    PendingIntent contentIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 0, open, PendingIntent.FLAG_CANCEL_CURRENT);

在manifest

<receiver android:name=".OpenBroadcastReceiver">
        <intent-filter>
            <action android:name="com.bupyc.pushall.app.OPEN" />
        </intent-filter>
    </receiver>

但是如果我发送更多的1通知意图不工作。它只适用于第一个通知

如果"PendingIntent. "FLAG_CANCEL_CURRENT"如何意图多个广播意图与其他url, lid额外?

Ok)我找到解决办法了:)

Intent close = new Intent(this, CloseBroadcastReceiver.class);
    close.setAction("com.bupyc.pushall.app.CANCEL"+NOTIFICATION_ID);

其作品和广播:)

最新更新