即使应用未运行,也会获取通知

时间:2016-01-06 03:51:27

标签: notifications broadcastreceiver

您好所有可以帮助我如何在特定日期获取通知,即使应用程序未处于运行状态,也可以提前感谢

1 个答案:

答案 0 :(得分:0)

您必须计算确切的日期并转换为长型。在通知中设置该时间。看起来像:

long time = System.currentTimeMillis(); // example, you should revise.
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification n = new Notification(R.drawable.notification_icon, context.getString(R.string.app_name), time);
manager.notify(Constants.NOTIFICATION_ID, n);
相关问题