//权限
<uses-permission android:name="android.permission.VIBRATE"/>
1.
//获取通知管理者
private NotificationManager notificationMg;
notificationMg = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
2.
Notification noti = new NotificationCompat.Builder(
MainActivity.this).setSmallIcon(R.drawable.icon) .setContentTitle("标题") .setContentText("这是askdfjkaksd内容") .setSmallIcon(R.drawable.icon) .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.icon)) .build();//链接结束 noti.defaults = Notification.DEFAULT_ALL; //震动,加提示音 notificationMg.notify(10,noti);//管理者发送通知,数字代表标识
关闭通知设置
notificationMg.cancel(10);