// 1. 获取到系统的notificationManager
NotificationManager notficationManager;
notficationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// 2. 实例化一个notification
String tickerText = "IP号码 设置完毕";
long when = System.currentTimeMillis();
Notification notification = new Notification(R.drawable.notification, tickerText, when);
// notification.flags= Notification.FLAG_NO_CLEAR
notification.sound = Uri.parse("/sdcard/haha.mp3");
//3 .设置用户点击notification的动作
// pendingIntent 延期的意图
Intent intent = new Intent(this,MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
// 把一个延期的意图设置给 notification
notification.setLatestEventInfo(this, "自动ip拨号设置完成", "ip号码为"+ipnumber, pendingIntent);
//4. 把定义的notification 传递给 notificationmanager
notficationManager.notify(0, notification);