/**
* 发送通知
*/
public void setNotification(){
/** start */
//1.得到NotificationManager:
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// 创立一个新的Notification对象,并添加图标
notification = new Notification();
// 通知显示的图标
notification.icon = R.drawable.icon_bao;
// 在状况栏(Status Bar)显示的通知文本提醒,如:
notification.tickerText = "收到一个新的通知";
//发出提醒音,如:
notification.defaults |= Notification.DEFAULT_SOUND;//或
// notification.sound = Uri.parse("file:///sdcard/notification/ringer.mp3");//或
// notification.sound = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "6");
//填充Notification的各个属性:
Context context = getApplicationContext();
CharSequence contentTitle = "通知题目";
CharSequence contentText = "通知内容";
//点击通知跳转到哪里
Intent notificationIntent = new Intent(this, CreateMemberActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
//在通知栏上点击此通知后主动消除此通知
notification.flags |= Notification.FLAG_AUTO_CANCEL;
//LED灯闪耀
notification.defaults |= Notification.DEFAULT_LIGHTS;
// 或可以自己的LED提醒模式:
// notification.ledARGB = 0xff00ff00;
// notification.ledOnMS = 300; //亮的时光
// notification.ledOffMS = 1000; //灭的时光
// notification.flags |= Notification.FLAG_SHOW_LIGHTS;
//手机振动
notification.defaults |= Notification.DEFAULT_VIBRATE;
// 或
// long[] vibrate = {0,100,200,300};
// notification.vibrate = vibrate;
//发送通知
mNotificationManager.notify(1, notification);
/** end */
}/**
* 发送通知
*/
public void setNotific