1在context裏定義通知管理器(NotificationManager)html
NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
2.定義和建立通知(Notification),而且設置相應的參數:通知標題,通知內容,通知時間,通知要調用的(燈光,聲音,震動等..)spa
Notification notification = new Notification(resId, tickerText, System.currentTimeMillis());
3.管理器調用通知.code
notificationManager.notify(id, notification);
參考:htm
http://www.cnblogs.com/newcj/archive/2011/03/14/1983782.htmlblog