1在context里定义通知管理器(NotificationManager)
NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
2.定义和创建通知(Notification),并且设置相应的参数:通知标题,通知内容,通知时间,通知要调用的(灯光,声音,震动等..)
Notification notification = new Notification(resId, tickerText, System.currentTimeMillis());
3.管理器调用通知.
notificationManager.notify(id, notification);
参考:
http://www.cnblogs.com/newcj/archive/2011/03/14/1983782.html
android 的通知管理
时间: 2024-10-11 00:57:46