代码
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon, "您有新消息了", System.currentTimeMillis());
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, getIntent(), 0);
notification.setLatestEventInfo(this, "天气预报", "晴转多云", contentIntent);
notificationManager.notify(R.drawable.icon, notification);
Notification notification = new Notification(R.drawable.icon, "您有新消息了", System.currentTimeMillis());
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, getIntent(), 0);
notification.setLatestEventInfo(this, "天气预报", "晴转多云", contentIntent);
notificationManager.notify(R.drawable.icon, notification);