intrequestCode = (int) System.currentTimeMillis();
Bitmap btm= BitmapFactory.decodeResource(getResources(), R.drawable.ic_menu_compose);
NotificationCompat.Builder mBuilder=newNotificationCompat.Builder(getApplication()).setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("文件下載成功").setContentText(fileName+"");
mBuilder.setTicker("新的消息");
//mBuilder.setNumber(12);
mBuilder.setLargeIcon(btm);
mBuilder.setAutoCancel(true);
mBuilder.setPriority(Notification.PRIORITY_MAX);
mBuilder.setDefaults(Notification.DEFAULT_ALL);
mBuilder.setOnlyAlertOnce(true);
//構(gòu)建一個(gè)intent
Intent resultIntent =newIntent();
resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//設(shè)置intent的Action屬性
resultIntent.setAction(Intent.ACTION_VIEW);
// Intent resultIntent=new Intent(getApplicationContext(), PushNewsActivity.class);
String type = Helper.getMIMEType(file);
//設(shè)置intent的data和Type屬性沧烈。
resultIntent.setDataAndType(/*uri*/Uri.fromFile(file), type);//? ? public Intent setDataAndType(Uri data, String type)
PendingIntent resultPI=PendingIntent.getActivity(getApplication(),requestCode,resultIntent,PendingIntent.FLAG_CANCEL_CURRENT);
mBuilder.setContentIntent(resultPI);
NotificationManager mNotif= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotif.notify(requestCode,mBuilder.build());