【问题标题】:Custom Notification in androidandroid中的自定义通知
【发布时间】:2017-02-12 23:55:20
【问题描述】:

对于我的应用,我需要在不同的时间发出不同的通知。假设我在上午 11 点、上午 12 点、下午 1 点设置了一个通知,所以一个 bt 它只给出最后一个。我使用了下面的代码

 Intent intent = new Intent(context, MediaActivity.class);
    RQS = (int) System.currentTimeMillis();

    PendingIntent pIntent = PendingIntent.getActivity(context, RQS, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);

NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(1, mBuilder.build());

我已经声明 private int RQS_1;在 MainActivity 我该如何解决?

【问题讨论】:

  • 欢迎来到stackoverflow。您的问题标题没有描述您的问题,并且问题含糊不清且写得不好。在改进您的问题之前,请参考How do I ask a good question? FAQ

标签: android notifications broadcastreceiver


【解决方案1】:

您对所有 3 个通知 ID 使用相同的通知 ID。当您使用相同的 ID 时,您会用新的 ID 覆盖旧的 ID。如果您希望所有 3 个都留下来,请使用不同的 ID。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多