- //状态栏通知
- private NotificationManager manager;
- manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
- private Notification.Builder buider;
- Intent intent = new Intent(MainActivity.this,MainActivity.class);
- PendingIntent content = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);
- buider = new Notification.Builder(this);
- buider.setContentIntent(content);
- buider.setContentTitle("biaoti");
- buider.setContentText("hello");
- Notification notification = buider.build(); //API16以后才能用
- manager.notify(1000,notification);
复制代码
|
|