//權限android
<uses-permission android:name="android.permission.VIBRATE"/>ui
1.this
//獲取通知管理者code
private NotificationManager notificationMg;
notificationMg = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);get
2.it
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);//管理者發送通知,數字表明標識io
關閉通知設置權限
notificationMg.cancel(10);map