1、通知栏提示
private void showAddNotify() {
manager = (NotificationManager) getActivity().getSystemService(
getActivity().NOTIFICATION_SERVICE);
notification = new Notification(R.drawable.icon_ft, "抢修工单",
System.currentTimeMillis());
// 点击之后跳转的Activity
Intent intent = new Intent(getActivity(), RepairListActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent contentIntent = PendingIntent.getActivity(getActivity(),
100, intent, PendingIntent.FLAG_CANCEL_CURRENT);
notification.setLatestEventInfo(getActivity(), "抢修工单", "您有新的抢修工单",
contentIntent);
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.defaults = Notification.DEFAULT_SOUND;// 默认声音
Vibrator vibrator = (Vibrator) getActivity().getSystemService(
Service.VIBRATOR_SERVICE);
vibrator.vibrate(500);// 震动时长
manager.notify(150, notification);
// startActivity(intent);
// 通知列表页刷新,
NotifyComponents.getInstance().notify(
NotifyEvent.NOTIFY_NEW_REPAIR_WORK, "");
}