Notification在通知栏发送通知以进行消息提醒
private int NOTIFICATION_ID = 0;
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
Builder builder = new Builder(MainActivity.this);
builder.setSmallIcon(R.drawable.ic_luancher);
builder.setContentTitle("新消息!");
builder.setContentText("您有新消息!");
builder.setSubText("消息的详细内容!");
builder.setAutoCancel(true);
builder.setContentIntent(pendingIntent);
Notification notification = builder.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID,notification);