Notification.Builder

Intent intent = new Intent(this, Two.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);

Notification notification = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setDefaults(Notification.DEFAULT_ALL)
.setAutoCancel(true).setContentText("content text")
.setContentTitle("content title")
.setContentInfo("content info").setTicker("ticker")
.setWhen(System.currentTimeMillis())
.setContentIntent(pendingIntent).build();

NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);        
mgr.notify(100, notification);
mgr.cancel(100);

 

posted @ 2013-11-26 16:08  songsiyao  阅读(358)  评论(0编辑  收藏  举报