标签:
Notification即通知栏,在android中常用如下几种功能:
1、客户端功能提示,如版本升级;
2、收到短信、新闻等提示;
3、显示当前情况,如下载进度等;
Notification基本应用如下:
Intent notifyIntent = new Intent(this, MainActivity.class); PendingIntent notify_Intent = PendingIntent.getActivity(this, 0, notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT); mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); mNotification = new NotificationCompat.Builder(getApplicationContext()) .setSmallIcon(R.drawable.ic_launcher) .setTicker("showNormal").setContentInfo("contentInfo") .setContentTitle("title").setContentText("content") .setNumber(1).setContentIntent(notify_Intent) .setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL) .build(); mNotificationManager.notify(0, mNotification);
标签:
原文地址:http://www.cnblogs.com/Fredric-2013/p/4245862.html