/**
* 提示用户当前报文容量超过50M
*/
private void notifyPacketTooLarge() {
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//定义通知栏展现的内容信息
CharSequence tickerText = "当前报文容量超过50M";
Notification notification = new Notification(R.drawable.ic_launcher, tickerText, System.currentTimeMillis());
notification.setLatestEventInfo(mContext, "报文容量过大", "报文容量已经超过50M!", null);
/*Intent notificationIntent = new Intent(this, BootStartDemo.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);*/
mNotificationManager.notify(, notification);
}
/**
* 提示用户当前报文容量超过50M,API 16以后版本
*/
@SuppressLint("NewApi")
private void notifyPacketTooLargeNew() {
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//定义通知栏展现的内容信息
CharSequence tickerText = "当前报文容量超过50M";
Notification notification = new Notification.Builder(mContext)
.setTicker(tickerText)
.setContentTitle("报文容量过大")
.setContentText("当前正在抓取的报文容量已经超过50M,请注意")
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.ic_launcher)
.build();
mNotificationManager.notify(, notification);
}