·设置通知栏图标;
·设置通知栏标题;
·设置通知栏内容;
·设置点击通知栏activity的跳转;
·设置闪灯/LED;(收到短信或来电话时)
·设置铃声、震动等;
NotificationManager notiManage = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notiManage.notify(1, noti);
noti哪来,请看:
Notification noti = new Notification();
noti.icon = R.drawable.ic_launcher;
noti.tickerText = "This is test!";
noti.when = System.currentTimeMillis(); //这里是显示时:分,如22:43
noti.setLatestEventInfo(this, noti.tickerText, "AAA", pendingIntent); //将以上东西setView到Notification上去,要不然显示什么呀
注:pendingIntent是个PendingIntent,看名字就知道,延迟的activity,指定义某一时间出现的Intent,当然你也可以设置为null。
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,intent, 0);
我的博客其它文章列表
http://my.oschina.net/helu