【问题标题】:Multiple intent to broadcast多意图广播
【发布时间】:2015-05-25 18:14:48
【问题描述】:

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

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

在清单中

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

但如果我发送更多 1 个通知意图将不起作用。它仅适用于第一次通知

如果“PendingIntent.FLAG_CANCEL_CURRENT”有问题,如何意图多个广播意图与其他网址、盖子额外内容?

【问题讨论】:

    标签: android android-intent notifications push-notification


    【解决方案1】:

    好的)我找到了解决方案:)

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

    它的作品和广播:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-15
      • 1970-01-01
      • 2012-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多